DarkCat09
3fbd283db1
- Catch AttributeError in `__del__` if process was not initialized and self.proc was not created - Skip test_jsnode if node is not installed - Removed package-lock from gitignore
32 lines
741 B
Python
Executable file
32 lines
741 B
Python
Executable file
#!/usr/bin/env python3
|
|
|
|
import unittest
|
|
|
|
from python_aternos import atjsparse
|
|
from tests import files
|
|
|
|
|
|
class TestJsNode(unittest.TestCase):
|
|
|
|
def setUp(self) -> None:
|
|
|
|
self.tests = files.read_sample('token_input.txt')
|
|
self.results = files.read_sample('token_output.txt')
|
|
|
|
try:
|
|
self.js = atjsparse.NodeInterpreter()
|
|
except OSError as err:
|
|
self.skipTest(
|
|
f'Unable to start NodeJS interpreter: {err}'
|
|
)
|
|
|
|
def test_exec(self) -> None:
|
|
|
|
for func, exp in zip(self.tests, self.results):
|
|
self.js.exec_js(func)
|
|
res = self.js['AJAX_TOKEN']
|
|
self.assertEqual(res, exp)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|