Tests: introduced module name configuration.
Also fixed problem with "/" in application name.
@@ -3,17 +3,22 @@ import shutil
import pytest
from unit.applications.proto import TestApplicationProto
+from urllib.parse import quote
from conftest import option
class TestApplicationPython(TestApplicationProto):
application_type = "python"
+ load_module = "wsgi"
- def load(self, script, name=None, **kwargs):
+ def load(self, script, name=None, module=None, **kwargs):
print()
if name is None:
name = script
+ if module is None:
+ module = self.load_module
+
if script[0] == '/':
script_path = script
else:
@@ -37,14 +42,16 @@ class TestApplicationPython(TestApplicationProto):
self._load_conf(
{
- "listeners": {"*:7080": {"pass": "applications/" + name}},
+ "listeners": {
+ "*:7080": {"pass": "applications/" + quote(name, '')}
+ },
"applications": {
name: {
"type": appication_type,
"processes": {"spare": 0},
"path": script_path,
"working_directory": script_path,
- "module": "wsgi",
+ "module": module,
}
},
},
