Tests: Node.js application tests.

This commit is contained in:
Sergey Kandaurov
2018-10-25 15:43:48 +03:00
parent 41d3d63758
commit 0fdc7c3a55
18 changed files with 342 additions and 0 deletions

View File

@@ -117,6 +117,12 @@ class TestUnit(unittest.TestCase):
except:
m = None
elif module == 'node':
if os.path.isdir(self.pardir + '/node/node_modules'):
m = module
else:
m = None
elif module == 'openssl':
try:
subprocess.check_output(['which', 'openssl'])
@@ -558,6 +564,35 @@ class TestUnitApplicationGo(TestUnitApplicationProto):
}
})
class TestUnitApplicationNode(TestUnitApplicationProto):
def load(self, script, name='app.js'):
# copy application
shutil.copytree(self.current_dir + '/node/' + script,
self.testdir + '/node')
# link modules
os.symlink(self.pardir + '/node/node_modules',
self.testdir + '/node/node_modules')
self.conf({
"listeners": {
"*:7080": {
"application": script
}
},
"applications": {
script: {
"type": "external",
"processes": { "spare": 0 },
"working_directory": self.testdir + '/node',
"executable": name
}
}
})
class TestUnitApplicationPerl(TestUnitApplicationProto):
def load(self, script, name='psgi.pl'):
self.conf({