summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrey Zelenkov <zelenkov@nginx.com>2018-09-06 20:18:33 +0300
committerAndrey Zelenkov <zelenkov@nginx.com>2018-09-06 20:18:33 +0300
commit511a0fa7605e61f90e524edfbcbefa230573e32f (patch)
tree011538ece353c804605a05452daa344e8be2d2fd
parent58d23eb5b4cc15a11fa4550dc165b6be4797525a (diff)
downloadunit-511a0fa7605e61f90e524edfbcbefa230573e32f.tar.gz
unit-511a0fa7605e61f90e524edfbcbefa230573e32f.tar.bz2
Tests: used relative path for configuration.
Diffstat (limited to '')
-rw-r--r--test/test_access_log.py10
-rw-r--r--test/test_configuration.py30
-rw-r--r--test/test_go_application.py8
-rw-r--r--test/test_php_application.py18
-rw-r--r--test/test_php_basic.py44
-rw-r--r--test/test_python_application.py6
-rw-r--r--test/test_python_basic.py48
-rw-r--r--test/test_python_environment.py22
-rw-r--r--test/test_python_procman.py34
-rw-r--r--test/test_settings.py19
-rw-r--r--test/unit.py12
11 files changed, 125 insertions, 126 deletions
diff --git a/test/test_access_log.py b/test/test_access_log.py
index bee7a7e5..05f5f54a 100644
--- a/test/test_access_log.py
+++ b/test/test_access_log.py
@@ -13,7 +13,7 @@ class TestUnitAccessLog(unit.TestUnitApplicationPython):
def load(self, script):
super().load(script)
- self.conf('"' + self.testdir + '/access.log"', '/access_log')
+ self.conf('"' + self.testdir + '/access.log"', 'access_log')
def search_in_log(self, pattern, name='access.log'):
with open(self.testdir + '/' + name, 'r') as f:
@@ -85,7 +85,7 @@ Connection: close
"[::1]:7080": {
"application": "empty"
}
- }, '/listeners')
+ }, 'listeners')
self.get(sock_type='ipv6')
@@ -106,7 +106,7 @@ Connection: close
"unix:" + addr: {
"application": "empty"
}
- }, '/listeners')
+ }, 'listeners')
self.get(sock_type='unix', addr=addr)
@@ -240,7 +240,7 @@ Connection: close
def test_access_log_delete(self):
self.load('empty')
- self.conf_delete('/access_log')
+ self.conf_delete('access_log')
self.get(url='/delete')
@@ -255,7 +255,7 @@ Connection: close
self.get()
- self.conf('"' + self.testdir + '/new.log"', '/access_log')
+ self.conf('"' + self.testdir + '/new.log"', 'access_log')
self.get()
diff --git a/test/test_configuration.py b/test/test_configuration.py
index 7e966b14..6db65bb3 100644
--- a/test/test_configuration.py
+++ b/test/test_configuration.py
@@ -22,9 +22,9 @@ class TestUnitConfiguration(unit.TestUnitControl):
"module": "wsgi"
}
}
- """, '/applications'), 'unicode')
+ """, 'applications'), 'unicode')
- self.assertDictEqual(self.conf_get('/applications'), {
+ self.assertDictEqual(self.conf_get('applications'), {
"app": {
"type": "python",
"processes": { "spare": 0 },
@@ -41,9 +41,9 @@ class TestUnitConfiguration(unit.TestUnitControl):
"path": "/app",
"module": "wsgi"
}
- }, '/applications'), 'unicode 2')
+ }, 'applications'), 'unicode 2')
- self.assertIn('приложение', self.conf_get('/applications'),
+ self.assertIn('приложение', self.conf_get('applications'),
'unicode 2 get')
def test_json_unicode_number(self):
@@ -56,13 +56,13 @@ class TestUnitConfiguration(unit.TestUnitControl):
"module": "wsgi"
}
}
- """, '/applications'), 'unicode number')
+ """, 'applications'), 'unicode number')
def test_applications_open_brace(self):
- self.assertIn('error', self.conf('{', '/applications'), 'open brace')
+ self.assertIn('error', self.conf('{', 'applications'), 'open brace')
def test_applications_string(self):
- self.assertIn('error', self.conf('"{}"', '/applications'), 'string')
+ self.assertIn('error', self.conf('"{}"', 'applications'), 'string')
def test_applications_type_only(self):
self.skip_alerts.extend([
@@ -75,7 +75,7 @@ class TestUnitConfiguration(unit.TestUnitControl):
"app": {
"type": "python"
}
- }, '/applications'), 'type only')
+ }, 'applications'), 'type only')
def test_applications_miss_quote(self):
self.assertIn('error', self.conf("""
@@ -87,7 +87,7 @@ class TestUnitConfiguration(unit.TestUnitControl):
"module": "wsgi"
}
}
- """, '/applications'), 'miss quote')
+ """, 'applications'), 'miss quote')
def test_applications_miss_colon(self):
self.assertIn('error', self.conf("""
@@ -99,7 +99,7 @@ class TestUnitConfiguration(unit.TestUnitControl):
"module": "wsgi"
}
}
- """, '/applications'), 'miss colon')
+ """, 'applications'), 'miss colon')
def test_applications_miss_comma(self):
self.assertIn('error', self.conf("""
@@ -111,10 +111,10 @@ class TestUnitConfiguration(unit.TestUnitControl):
"module": "wsgi"
}
}
- """, '/applications'), 'miss comma')
+ """, 'applications'), 'miss comma')
def test_applications_skip_spaces(self):
- self.assertIn('success', self.conf(b'{ \n\r\t}', '/applications'),
+ self.assertIn('success', self.conf(b'{ \n\r\t}', 'applications'),
'skip spaces')
def test_applications_relative_path(self):
@@ -125,7 +125,7 @@ class TestUnitConfiguration(unit.TestUnitControl):
"path": "../app",
"module": "wsgi"
}
- }, '/applications'), 'relative path')
+ }, 'applications'), 'relative path')
@unittest.expectedFailure
def test_listeners_empty(self):
@@ -136,12 +136,12 @@ class TestUnitConfiguration(unit.TestUnitControl):
r'process \d+ exited on signal'
])
- self.assertIn('error', self.conf({"*:7080":{}}, '/listeners'),
+ self.assertIn('error', self.conf({"*:7080":{}}, 'listeners'),
'listener empty')
def test_listeners_no_app(self):
self.assertIn('error', self.conf({"*:7080":{"application":"app"}},
- '/listeners'), 'listeners no app')
+ 'listeners'), 'listeners no app')
def test_listeners_wildcard(self):
self.assertIn('success', self.conf({
diff --git a/test/test_go_application.py b/test/test_go_application.py
index abc2c4c1..650d1c27 100644
--- a/test/test_go_application.py
+++ b/test/test_go_application.py
@@ -110,13 +110,13 @@ class TestUnitGoApplication(unit.TestUnitApplicationGo):
self.load('command_line_arguments')
self.assertIn('error', self.conf(''"a b c",
- '/applications/command_line_arguments/arguments'), 'arguments type')
+ 'applications/command_line_arguments/arguments'), 'arguments type')
def test_go_application_command_line_arguments_0(self):
self.load('command_line_arguments')
self.assertEqual(self.get()['headers']['X-Arg-0'],
- self.conf_get('/applications/command_line_arguments/executable'),
+ self.conf_get('applications/command_line_arguments/executable'),
'argument 0')
def test_go_application_command_line_arguments(self):
@@ -127,7 +127,7 @@ class TestUnitGoApplication(unit.TestUnitApplicationGo):
arg3 = '--debug'
self.conf('["' + arg1 + '", "' + arg2 + '", "' + arg3 + '"]',
- '/applications/command_line_arguments/arguments')
+ 'applications/command_line_arguments/arguments')
self.assertEqual(self.get()['body'], arg1 + ',' + arg2 + ',' + arg3,
'arguments')
@@ -135,7 +135,7 @@ class TestUnitGoApplication(unit.TestUnitApplicationGo):
def test_go_application_command_line_arguments_change(self):
self.load('command_line_arguments')
- args_path = '/applications/command_line_arguments/arguments'
+ args_path = 'applications/command_line_arguments/arguments'
self.conf('["0", "a", "$", ""]', args_path)
diff --git a/test/test_php_application.py b/test/test_php_application.py
index c8ae8ad0..0dbc743d 100644
--- a/test/test_php_application.py
+++ b/test/test_php_application.py
@@ -124,7 +124,7 @@ class TestUnitPHPApplication(unit.TestUnitApplicationPHP):
self.assertNotEqual(self.get()['headers']['X-Precision'], '4',
'ini value default')
- self.conf({"file": "php.ini"}, '/applications/ini_precision/options')
+ self.conf({"file": "php.ini"}, 'applications/ini_precision/options')
self.assertEqual(self.get()['headers']['X-File'],
self.current_dir + '/php/ini_precision/php.ini', 'ini file')
@@ -137,7 +137,7 @@ class TestUnitPHPApplication(unit.TestUnitApplicationPHP):
self.assertIn('error', self.conf({
"user": { "precision": "4" },
"admin": { "precision": "5" }
- }, '/applications/ini_precision/options'), 'ini admin user')
+ }, 'applications/ini_precision/options'), 'ini admin user')
def test_php_application_ini_admin(self):
self.load('ini_precision')
@@ -145,7 +145,7 @@ class TestUnitPHPApplication(unit.TestUnitApplicationPHP):
self.conf({
"file": "php.ini",
"admin": { "precision": "5" }
- }, '/applications/ini_precision/options')
+ }, 'applications/ini_precision/options')
self.assertEqual(self.get()['headers']['X-Precision'], '5',
'ini value admin')
@@ -156,7 +156,7 @@ class TestUnitPHPApplication(unit.TestUnitApplicationPHP):
self.conf({
"file": "php.ini",
"user": { "precision": "5" }
- }, '/applications/ini_precision/options')
+ }, 'applications/ini_precision/options')
self.assertEqual(self.get()['headers']['X-Precision'], '5',
'ini value user')
@@ -164,13 +164,13 @@ class TestUnitPHPApplication(unit.TestUnitApplicationPHP):
def test_php_application_ini_user_2(self):
self.load('ini_precision')
- self.conf({"file": "php.ini"}, '/applications/ini_precision/options')
+ self.conf({"file": "php.ini"}, 'applications/ini_precision/options')
self.assertEqual(self.get()['headers']['X-Precision'], '4',
'ini user file')
self.conf({ "precision": "5" },
- '/applications/ini_precision/options/user')
+ 'applications/ini_precision/options/user')
self.assertEqual(self.get()['headers']['X-Precision'], '5',
'ini value user')
@@ -179,7 +179,7 @@ class TestUnitPHPApplication(unit.TestUnitApplicationPHP):
self.load('ini_precision')
self.conf({"admin": { "precision": "5" }},
- '/applications/ini_precision/options')
+ 'applications/ini_precision/options')
self.assertEqual(self.get(url='/?precision=6')['headers']['X-Precision'],
'5', 'ini set admin')
@@ -188,7 +188,7 @@ class TestUnitPHPApplication(unit.TestUnitApplicationPHP):
self.load('ini_precision')
self.conf({"user": { "precision": "5" }},
- '/applications/ini_precision/options')
+ 'applications/ini_precision/options')
self.assertEqual(self.get(url='/?precision=6')['headers']['X-Precision'],
'6', 'ini set user')
@@ -197,7 +197,7 @@ class TestUnitPHPApplication(unit.TestUnitApplicationPHP):
self.load('ini_precision')
self.conf({"user": { "precision": "5" }},
- '/applications/ini_precision/options')
+ 'applications/ini_precision/options')
self.assertEqual(self.get()['headers']['X-Precision'], '5', 'ini value')
diff --git a/test/test_php_basic.py b/test/test_php_basic.py
index 0205c634..9e0ce822 100644
--- a/test/test_php_basic.py
+++ b/test/test_php_basic.py
@@ -25,7 +25,7 @@ class TestUnitPHPBasic(unit.TestUnitControl):
}
def test_php_get_applications(self):
- self.conf(self.conf_app, '/applications')
+ self.conf(self.conf_app, 'applications')
conf = self.conf_get()
@@ -42,9 +42,9 @@ class TestUnitPHPBasic(unit.TestUnitControl):
'applications')
def test_php_get_applications_prefix(self):
- self.conf(self.conf_app, '/applications')
+ self.conf(self.conf_app, 'applications')
- self.assertEqual(self.conf_get('/applications'),
+ self.assertEqual(self.conf_get('applications'),
{
"app": {
"type": "php",
@@ -56,9 +56,9 @@ class TestUnitPHPBasic(unit.TestUnitControl):
'applications prefix')
def test_php_get_applications_prefix_2(self):
- self.conf(self.conf_app, '/applications')
+ self.conf(self.conf_app, 'applications')
- self.assertEqual(self.conf_get('/applications/app'),
+ self.assertEqual(self.conf_get('applications/app'),
{
"type": "php",
"processes": { "spare": 0 },
@@ -68,11 +68,11 @@ class TestUnitPHPBasic(unit.TestUnitControl):
'applications prefix 2')
def test_php_get_applications_prefix_3(self):
- self.conf(self.conf_app, '/applications')
+ self.conf(self.conf_app, 'applications')
- self.assertEqual(self.conf_get('/applications/app/type'), 'php',
+ self.assertEqual(self.conf_get('applications/app/type'), 'php',
'type')
- self.assertEqual(self.conf_get('/applications/app/processes/spare'), 0,
+ self.assertEqual(self.conf_get('applications/app/processes/spare'), 0,
'spare processes')
def test_php_get_listeners(self):
@@ -84,27 +84,27 @@ class TestUnitPHPBasic(unit.TestUnitControl):
def test_php_get_listeners_prefix(self):
self.conf(self.conf_basic)
- self.assertEqual(self.conf_get('/listeners'),
+ self.assertEqual(self.conf_get('listeners'),
{"*:7080":{"application":"app"}}, 'listeners prefix')
def test_php_get_listeners_prefix_2(self):
self.conf(self.conf_basic)
- self.assertEqual(self.conf_get('/listeners/*:7080'),
+ self.assertEqual(self.conf_get('listeners/*:7080'),
{"application":"app"}, 'listeners prefix 2')
def test_php_change_listener(self):
self.conf(self.conf_basic)
- self.conf({"*:7081":{"application":"app"}}, '/listeners')
+ self.conf({"*:7081":{"application":"app"}}, 'listeners')
- self.assertEqual(self.conf_get('/listeners'),
+ self.assertEqual(self.conf_get('listeners'),
{"*:7081": {"application":"app"}}, 'change listener')
def test_php_add_listener(self):
self.conf(self.conf_basic)
- self.conf({"application":"app"}, '/listeners/*:7082')
+ self.conf({"application":"app"}, 'listeners/*:7082')
- self.assertEqual(self.conf_get('/listeners'),
+ self.assertEqual(self.conf_get('listeners'),
{
"*:7080": {
"application": "app"
@@ -118,24 +118,24 @@ class TestUnitPHPBasic(unit.TestUnitControl):
def test_php_change_application(self):
self.conf(self.conf_basic)
- self.conf('30', '/applications/app/processes/max')
- self.assertEqual(self.conf_get('/applications/app/processes/max'), 30,
+ self.conf('30', 'applications/app/processes/max')
+ self.assertEqual(self.conf_get('applications/app/processes/max'), 30,
'change application max')
- self.conf('"/www"', '/applications/app/root')
- self.assertEqual(self.conf_get('/applications/app/root'), '/www',
+ self.conf('"/www"', 'applications/app/root')
+ self.assertEqual(self.conf_get('applications/app/root'), '/www',
'change application root')
def test_php_delete(self):
self.conf(self.conf_basic)
- self.assertIn('error', self.conf_delete('/applications/app'),
+ self.assertIn('error', self.conf_delete('applications/app'),
'delete app before listener')
- self.assertIn('success', self.conf_delete('/listeners/*:7080'),
+ self.assertIn('success', self.conf_delete('listeners/*:7080'),
'delete listener')
- self.assertIn('success', self.conf_delete('/applications/app'),
+ self.assertIn('success', self.conf_delete('applications/app'),
'delete app after listener')
- self.assertIn('error', self.conf_delete('/applications/app'),
+ self.assertIn('error', self.conf_delete('applications/app'),
'delete app again')
if __name__ == '__main__':
diff --git a/test/test_python_application.py b/test/test_python_application.py
index 59857d75..146223ec 100644
--- a/test/test_python_application.py
+++ b/test/test_python_application.py
@@ -131,7 +131,7 @@ class TestUnitPythonApplication(unit.TestUnitApplicationPython):
self.assertIn('success', self.conf({
"spare": i % 4,
"max": (i % 4) + 1
- }, '/applications/mirror/processes'), 'reconfigure')
+ }, 'applications/mirror/processes'), 'reconfigure')
socks.append(sock)
@@ -146,7 +146,7 @@ class TestUnitPythonApplication(unit.TestUnitApplicationPython):
self.assertIn('success', self.conf({
"spare": i % 4,
"max": (i % 4) + 1
- }, '/applications/mirror/processes'), 'reconfigure 2')
+ }, 'applications/mirror/processes'), 'reconfigure 2')
for i in range(conns):
resp = self.post(headers={
@@ -159,7 +159,7 @@ class TestUnitPythonApplication(unit.TestUnitApplicationPython):
self.assertIn('success', self.conf({
"spare": i % 4,
"max": (i % 4) + 1
- }, '/applications/mirror/processes'), 'reconfigure 3')
+ }, 'applications/mirror/processes'), 'reconfigure 3')
def test_python_keepalive_reconfigure_2(self):
self.skip_alerts.append(r'sendmsg.+failed')
diff --git a/test/test_python_basic.py b/test/test_python_basic.py
index 794b7197..4cb194f6 100644
--- a/test/test_python_basic.py
+++ b/test/test_python_basic.py
@@ -29,13 +29,13 @@ class TestUnitPythonBasic(unit.TestUnitControl):
{'listeners': {}, 'applications': {}}, 'empty')
def test_python_get_prefix_listeners(self):
- self.assertEqual(self.conf_get('/listeners'), {}, 'listeners prefix')
+ self.assertEqual(self.conf_get('listeners'), {}, 'listeners prefix')
def test_python_get_prefix_applications(self):
- self.assertEqual(self.conf_get('/applications'), {}, 'applications prefix')
+ self.assertEqual(self.conf_get('applications'), {}, 'applications prefix')
def test_python_get_applications(self):
- self.conf(self.conf_app, '/applications')
+ self.conf(self.conf_app, 'applications')
conf = self.conf_get()
@@ -52,9 +52,9 @@ class TestUnitPythonBasic(unit.TestUnitControl):
'applications')
def test_python_get_applications_prefix(self):
- self.conf(self.conf_app, '/applications')
+ self.conf(self.conf_app, 'applications')
- self.assertEqual(self.conf_get('/applications'),
+ self.assertEqual(self.conf_get('applications'),
{
"app": {
"type": "python",
@@ -66,9 +66,9 @@ class TestUnitPythonBasic(unit.TestUnitControl):
'applications prefix')
def test_python_get_applications_prefix_2(self):
- self.conf(self.conf_app, '/applications')
+ self.conf(self.conf_app, 'applications')
- self.assertEqual(self.conf_get('/applications/app'),
+ self.assertEqual(self.conf_get('applications/app'),
{
"type": "python",
"processes": { "spare": 0 },
@@ -78,11 +78,11 @@ class TestUnitPythonBasic(unit.TestUnitControl):
'applications prefix 2')
def test_python_get_applications_prefix_3(self):
- self.conf(self.conf_app, '/applications')
+ self.conf(self.conf_app, 'applications')
- self.assertEqual(self.conf_get('/applications/app/type'), 'python',
+ self.assertEqual(self.conf_get('applications/app/type'), 'python',
'type')
- self.assertEqual(self.conf_get('/applications/app/processes/spare'), 0,
+ self.assertEqual(self.conf_get('applications/app/processes/spare'), 0,
'spare')
def test_python_get_listeners(self):
@@ -94,27 +94,27 @@ class TestUnitPythonBasic(unit.TestUnitControl):
def test_python_get_listeners_prefix(self):
self.conf(self.conf_basic)
- self.assertEqual(self.conf_get('/listeners'),
+ self.assertEqual(self.conf_get('listeners'),
{"*:7080":{"application":"app"}}, 'listeners prefix')
def test_python_get_listeners_prefix_2(self):
self.conf(self.conf_basic)
- self.assertEqual(self.conf_get('/listeners/*:7080'),
+ self.assertEqual(self.conf_get('listeners/*:7080'),
{"application":"app"}, 'listeners prefix 2')
def test_python_change_listener(self):
self.conf(self.conf_basic)
- self.conf({"*:7081":{"application":"app"}}, '/listeners')
+ self.conf({"*:7081":{"application":"app"}}, 'listeners')
- self.assertEqual(self.conf_get('/listeners'),
+ self.assertEqual(self.conf_get('listeners'),
{"*:7081": {"application":"app"}}, 'change listener')
def test_python_add_listener(self):
self.conf(self.conf_basic)
- self.conf({"application":"app"}, '/listeners/*:7082')
+ self.conf({"application":"app"}, 'listeners/*:7082')
- self.assertEqual(self.conf_get('/listeners'),
+ self.assertEqual(self.conf_get('listeners'),
{
"*:7080": {
"application": "app"
@@ -128,24 +128,24 @@ class TestUnitPythonBasic(unit.TestUnitControl):
def test_python_change_application(self):
self.conf(self.conf_basic)
- self.conf('30', '/applications/app/processes/max')
- self.assertEqual(self.conf_get('/applications/app/processes/max'), 30,
+ self.conf('30', 'applications/app/processes/max')
+ self.assertEqual(self.conf_get('applications/app/processes/max'), 30,
'change application max')
- self.conf('"/www"', '/applications/app/path')
- self.assertEqual(self.conf_get('/applications/app/path'), '/www',
+ self.conf('"/www"', 'applications/app/path')
+ self.assertEqual(self.conf_get('applications/app/path'), '/www',
'change application path')
def test_python_delete(self):
self.conf(self.conf_basic)
- self.assertIn('error', self.conf_delete('/applications/app'),
+ self.assertIn('error', self.conf_delete('applications/app'),
'delete app before listener')
- self.assertIn('success', self.conf_delete('/listeners/*:7080'),
+ self.assertIn('success', self.conf_delete('listeners/*:7080'),
'delete listener')
- self.assertIn('success', self.conf_delete('/applications/app'),
+ self.assertIn('success', self.conf_delete('applications/app'),
'delete app after listener')
- self.assertIn('error', self.conf_delete('/applications/app'),
+ self.assertIn('error', self.conf_delete('applications/app'),
'delete app again')
if __name__ == '__main__':
diff --git a/test/test_python_environment.py b/test/test_python_environment.py
index 278f7952..907ad57c 100644
--- a/test/test_python_environment.py
+++ b/test/test_python_environment.py
@@ -11,28 +11,28 @@ class TestUnitPythonEnvironment(unit.TestUnitApplicationPython):
self.assertIn('error', self.conf({
"va\0r": "val1"
- }, '/applications/environment/environment'), 'name null')
+ }, 'applications/environment/environment'), 'name null')
def test_python_environment_name_equals(self):
self.load('environment')
self.assertIn('error', self.conf({
"var=": "val1"
- }, '/applications/environment/environment'), 'name equals')
+ }, 'applications/environment/environment'), 'name equals')
def test_python_environment_value_null(self):
self.load('environment')
self.assertIn('error', self.conf({
"var": "\0val"
- }, '/applications/environment/environment'), 'value null')
+ }, 'applications/environment/environment'), 'value null')
def test_python_environment_update(self):
self.load('environment')
self.conf({
"var": "val1"
- }, '/applications/environment/environment')
+ }, 'applications/environment/environment')
self.assertEqual(self.get(headers={
'Host': 'localhost',
@@ -42,7 +42,7 @@ class TestUnitPythonEnvironment(unit.TestUnitApplicationPython):
self.conf({
"var": "val2"
- }, '/applications/environment/environment')
+ }, 'applications/environment/environment')
self.assertEqual(self.get(headers={
'Host': 'localhost',
@@ -55,7 +55,7 @@ class TestUnitPythonEnvironment(unit.TestUnitApplicationPython):
self.conf({
"var1": "val1"
- }, '/applications/environment/environment')
+ }, 'applications/environment/environment')
self.assertEqual(self.get(headers={
'Host': 'localhost',
@@ -65,7 +65,7 @@ class TestUnitPythonEnvironment(unit.TestUnitApplicationPython):
self.conf({
"var2": "val2"
- }, '/applications/environment/environment')
+ }, 'applications/environment/environment')
self.assertEqual(self.get(headers={
'Host': 'localhost',
@@ -79,7 +79,7 @@ class TestUnitPythonEnvironment(unit.TestUnitApplicationPython):
self.conf({
"var1": "val1",
"var2": "val2"
- }, '/applications/environment/environment')
+ }, 'applications/environment/environment')
self.assertEqual(self.get(headers={
'Host': 'localhost',
@@ -87,7 +87,7 @@ class TestUnitPythonEnvironment(unit.TestUnitApplicationPython):
'Connection': 'close'
})['body'], 'val1,val2,', 'set')
- self.conf({}, '/applications/environment/environment')
+ self.conf({}, 'applications/environment/environment')
self.assertEqual(self.get(headers={
'Host': 'localhost',
@@ -108,7 +108,7 @@ class TestUnitPythonEnvironment(unit.TestUnitApplicationPython):
self.conf({
"PWD": "new/pwd"
- }, '/applications/environment/environment')
+ }, 'applications/environment/environment')
self.assertEqual(self.get(headers={
'Host': 'localhost',
@@ -116,7 +116,7 @@ class TestUnitPythonEnvironment(unit.TestUnitApplicationPython):
'Connection': 'close'
})['body'], 'new/pwd,', 'replace default')
- self.conf({}, '/applications/environment/environment')
+ self.conf({}, 'applications/environment/environment')
self.assertEqual(self.get(headers={
'Host': 'localhost',
diff --git a/test/test_python_procman.py b/test/test_python_procman.py
index a2113f71..297484eb 100644
--- a/test/test_python_procman.py
+++ b/test/test_python_procman.py
@@ -27,7 +27,7 @@ class TestUnitPythonProcman(unit.TestUnitApplicationPython):
self.load('empty', self.app_name)
def test_python_processes_access(self):
- self.conf('1', '/applications/' + self.app_name + '/processes')
+ self.conf('1', 'applications/' + self.app_name + '/processes')
self.assertIn('error', self.conf_get('/applications/' + self.app_name +
'/processes/max'), 'max no access')
@@ -39,22 +39,22 @@ class TestUnitPythonProcman(unit.TestUnitApplicationPython):
def test_python_processes_spare_negative(self):
self.assertIn('error', self.conf({
"spare": -1
- }, '/applications/' + self.app_name + '/processes'), 'negative spare')
+ }, 'applications/' + self.app_name + '/processes'), 'negative spare')
def test_python_processes_max_negative(self):
self.assertIn('error', self.conf({
"max": -1
- }, '/applications/' + self.app_name + '/processes'), 'negative max')
+ }, 'applications/' + self.app_name + '/processes'), 'negative max')
def test_python_processes_idle_timeout_negative(self):
self.assertIn('error', self.conf({
"idle_timeout": -1
- }, '/applications/' + self.app_name + '/processes'),
+ }, 'applications/' + self.app_name + '/processes'),
'negative idle_timeout')
def test_python_processes_spare_gt_max_default(self):
self.assertIn('error', self.conf({"spare": 2},
- '/applications/' + self.app_name + '/processes'),
+ 'applications/' + self.app_name + '/processes'),
'spare greater than max default')
def test_python_processes_spare_gt_max(self):
@@ -70,20 +70,20 @@ class TestUnitPythonProcman(unit.TestUnitApplicationPython):
"spare": 0,
"max": 0,
"idle_timeout": 1
- }, '/applications/' + self.app_name + '/processes'), 'max 0')
+ }, 'applications/' + self.app_name + '/processes'), 'max 0')
def test_python_processes_idle_timeout_zero(self):
self.conf({
"spare": 0,
"max": 2,
"idle_timeout": 0
- }, '/applications/' + self.app_name + '/processes')
+ }, 'applications/' + self.app_name + '/processes')
self.get()
self.assertEqual(len(self.pids_for_process()), 0, 'idle timeout 0')
def test_python_prefork(self):
- self.conf('2', '/applications/' + self.app_name + '/processes')
+ self.conf('2', 'applications/' + self.app_name + '/processes')
pids = self.pids_for_process()
self.assertEqual(len(pids), 2, 'prefork 2')
@@ -91,7 +91,7 @@ class TestUnitPythonProcman(unit.TestUnitApplicationPython):
self.get()
self.assertSetEqual(self.pids_for_process(), pids, 'prefork still 2')
- self.conf('4', '/applications/' + self.app_name + '/processes')
+ self.conf('4', 'applications/' + self.app_name + '/processes')
pids = self.pids_for_process()
self.assertEqual(len(pids), 4, 'prefork 4')
@@ -103,11 +103,11 @@ class TestUnitPythonProcman(unit.TestUnitApplicationPython):
@unittest.expectedFailure
def test_python_prefork_same_processes(self):
- self.conf('2', '/applications/' + self.app_name + '/processes')
+ self.conf('2', 'applications/' + self.app_name + '/processes')
pids = self.pids_for_process()
- self.conf('4', '/applications/' + self.app_name + '/processes')
+ self.conf('4', 'applications/' + self.app_name + '/processes')
pids_new = self.pids_for_process()
@@ -118,7 +118,7 @@ class TestUnitPythonProcman(unit.TestUnitApplicationPython):
"spare": 0,
"max": 8,
"idle_timeout": 1
- }, '/applications/' + self.app_name + '/processes')
+ }, 'applications/' + self.app_name + '/processes')
self.assertEqual(len(self.pids_for_process()), 0, 'on-demand 0')
@@ -140,7 +140,7 @@ class TestUnitPythonProcman(unit.TestUnitApplicationPython):
"spare": 2,
"max": 8,
"idle_timeout": 1
- }, '/applications/' + self.app_name + '/processes')
+ }, 'applications/' + self.app_name + '/processes')
pids = self.pids_for_process()
self.assertEqual(len(pids), 2, 'updown 2')
@@ -170,7 +170,7 @@ class TestUnitPythonProcman(unit.TestUnitApplicationPython):
"spare": 2,
"max": 6,
"idle_timeout": 1
- }, '/applications/' + self.app_name + '/processes')
+ }, 'applications/' + self.app_name + '/processes')
pids = self.pids_for_process()
self.assertEqual(len(pids), 2, 'reconf 2')
@@ -180,7 +180,7 @@ class TestUnitPythonProcman(unit.TestUnitApplicationPython):
self.assertEqual(len(pids_new), 3, 'reconf 3')
self.assertTrue(pids.issubset(pids_new), 'reconf 3 only 1 new')
- self.conf('6', '/applications/' + self.app_name + '/processes/spare')
+ self.conf('6', 'applications/' + self.app_name + '/processes/spare')
pids = self.pids_for_process()
self.assertEqual(len(pids), 6, 'reconf 6')
@@ -195,7 +195,7 @@ class TestUnitPythonProcman(unit.TestUnitApplicationPython):
"spare": 0,
"max": 6,
"idle_timeout": 2
- }, '/applications/' + self.app_name + '/processes')
+ }, 'applications/' + self.app_name + '/processes')
self.get()
pids = self.pids_for_process()
@@ -221,7 +221,7 @@ class TestUnitPythonProcman(unit.TestUnitApplicationPython):
"spare": 0,
"max": 6,
"idle_timeout": 2
- }, '/applications/' + self.app_name + '/processes')
+ }, 'applications/' + self.app_name + '/processes')
(resp, sock) = self.get(headers={
'Host': 'localhost',
diff --git a/test/test_settings.py b/test/test_settings.py
index 845bfb14..4b9304e9 100644
--- a/test/test_settings.py
+++ b/test/test_settings.py
@@ -11,7 +11,7 @@ class TestUnitSettings(unit.TestUnitApplicationPython):
def test_settings_header_read_timeout(self):
self.load('empty')
- self.conf({'http': { 'header_read_timeout': 2 }}, '/settings')
+ self.conf({'http': { 'header_read_timeout': 2 }}, 'settings')
(resp, sock) = self.http(b"""GET / HTTP/1.1
""", start=True, raw=True)
@@ -29,7 +29,7 @@ Connection: close
def test_settings_header_read_timeout_update(self):
self.load('empty')
- self.conf({'http': { 'header_read_timeout': 4 }}, '/settings')
+ self.conf({'http': { 'header_read_timeout': 4 }}, 'settings')
(resp, sock) = self.http(b"""GET / HTTP/1.1
""", start=True, raw=True, no_recv=True)
@@ -56,7 +56,7 @@ Connection: close
def test_settings_body_read_timeout(self):
self.load('empty')
- self.conf({'http': { 'body_read_timeout': 2 }}, '/settings')
+ self.conf({'http': { 'body_read_timeout': 2 }}, 'settings')
(resp, sock) = self.http(b"""POST / HTTP/1.1
Host: localhost
@@ -74,7 +74,7 @@ Connection: close
def test_settings_body_read_timeout_update(self):
self.load('empty')
- self.conf({'http': { 'body_read_timeout': 4 }}, '/settings')
+ self.conf({'http': { 'body_read_timeout': 4 }}, 'settings')
(resp, sock) = self.http(b"""POST / HTTP/1.1
Host: localhost
@@ -102,11 +102,11 @@ Connection: close
data_len = 1048576
- self.conf({'http': { 'send_timeout': 1 }}, '/settings')
+ self.conf({'http': { 'send_timeout': 1 }}, 'settings')
addr = self.testdir + '/sock'
- self.conf({"unix:" + addr: {'application': 'mirror'}}, '/listeners')
+ self.conf({"unix:" + addr: {'application': 'mirror'}}, 'listeners')
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
sock.connect(addr)
@@ -134,7 +134,7 @@ Content-Length: %d
def test_settings_idle_timeout(self):
self.load('empty')
- self.conf({'http': { 'idle_timeout': 2 }}, '/settings')
+ self.conf({'http': { 'idle_timeout': 2 }}, 'settings')
(resp, sock) = self.get(headers={
'Connection': 'keep-alive',
@@ -153,7 +153,7 @@ Content-Length: %d
def test_settings_max_body_size(self):
self.load('empty')
- self.conf({'http': { 'max_body_size': 5 }}, '/settings')
+ self.conf({'http': { 'max_body_size': 5 }}, 'settings')
self.assertEqual(self.post(body='01234')['status'], 200, 'status size')
self.assertEqual(self.post(body='012345')['status'], 413,
@@ -162,8 +162,7 @@ Content-Length: %d
@unittest.expectedFailure
def test_settings_negative_value(self):
self.assertIn('error', self.conf({'http': { 'max_body_size': -1 }},
- '/settings'), 'settings negative value')
-
+ 'settings'), 'settings negative value')
if __name__ == '__main__':
unittest.main()
diff --git a/test/unit.py b/test/unit.py
index 973a69b7..58c8327d 100644
--- a/test/unit.py
+++ b/test/unit.py
@@ -334,8 +334,8 @@ class TestUnitControl(TestUnitHTTP):
if isinstance(conf, dict):
conf = json.dumps(conf)
- if path != '/config':
- path = '/config' + path
+ if path[:1] != '/':
+ path = '/config/' + path
return json.loads(self.put(
url=path,
@@ -345,8 +345,8 @@ class TestUnitControl(TestUnitHTTP):
)['body'])
def conf_get(self, path='/config'):
- if path != '/config':
- path = '/config' + path
+ if path[:1] != '/':
+ path = '/config/' + path
return json.loads(self.get(
url=path,
@@ -355,8 +355,8 @@ class TestUnitControl(TestUnitHTTP):
)['body'])
def conf_delete(self, path='/config'):
- if path != '/config':
- path = '/config' + path
+ if path[:1] != '/':
+ path = '/config/' + path
return json.loads(self.delete(
url=path,