Tests: Node.js application tests.
This commit is contained in:
35
test/unit.py
35
test/unit.py
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user