diff options
author | Andrey Zelenkov <zelenkov@nginx.com> | 2018-01-30 16:16:52 +0300 |
---|---|---|
committer | Andrey Zelenkov <zelenkov@nginx.com> | 2018-01-30 16:16:52 +0300 |
commit | 9f48f2b3e78d268c39dbd772a0a0f9ef07530846 (patch) | |
tree | 31192ccbf0d89b9b31e473a39195cb7477a780e5 /test/test_python_application.py | |
parent | f115cb7032dc0a2a2fa5ef6f66167efdd6b93544 (diff) | |
download | unit-9f48f2b3e78d268c39dbd772a0a0f9ef07530846.tar.gz unit-9f48f2b3e78d268c39dbd772a0a0f9ef07530846.tar.bz2 |
Tests: added methods to manage unit configuration.
Diffstat (limited to '')
-rw-r--r-- | test/test_python_application.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/test/test_python_application.py b/test/test_python_application.py index d2c2b73e..a81ffe65 100644 --- a/test/test_python_application.py +++ b/test/test_python_application.py @@ -9,8 +9,8 @@ class TestUnitApplication(unit.TestUnitControl): u.check_modules('python') u.check_version('0.4') - conf = """ - { + def conf_with_name(self, name): + self.conf({ "listeners": { "*:7080": { "application": "app" @@ -20,12 +20,11 @@ class TestUnitApplication(unit.TestUnitControl): "app": { "type": "python", "workers": 1, - "path": "%s", + "path": self.testdir + '/' + name, "module": "wsgi" } } - } - """ + }) def test_python_application_simple(self): code, name = """ @@ -49,7 +48,7 @@ def application(environ, start_response): """, 'py_app' self.python_application(name, code) - self.put('/', self.conf % (self.testdir + '/' + name)) + self.conf_with_name(name) body = 'Test body string.' @@ -88,7 +87,7 @@ def application(environ, start_response): """, 'py_app' self.python_application(name, code) - self.put('/', self.conf % (self.testdir + '/' + name)) + self.conf_with_name(name) r = unit.TestUnitHTTP.get(uri='/?var1=val1&var2=val2', headers={ 'Host': 'localhost' @@ -117,7 +116,7 @@ def application(environ, start_response): """, 'py_app' self.python_application(name, code) - self.put('/', self.conf % (self.testdir + '/' + name)) + self.conf_with_name(name) r = unit.TestUnitHTTP.get(headers={'Host': 'localhost'}) @@ -136,7 +135,7 @@ def application(environ, start_response): """, 'py_app' self.python_application(name, code) - self.put('/', self.conf % (self.testdir + '/' + name)) + self.conf_with_name(name) r = unit.TestUnitHTTP.get(headers={'Host': 'localhost'}) self.assertNotIn('Transfer-Encoding', r.headers, |