summaryrefslogtreecommitdiffhomepage
path: root/test/test_python_application.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_python_application.py')
-rw-r--r--test/test_python_application.py17
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,