summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--test/test_configuration.py22
-rw-r--r--test/test_python_procman.py16
-rw-r--r--test/unit.py2
3 files changed, 29 insertions, 11 deletions
diff --git a/test/test_configuration.py b/test/test_configuration.py
index 700e4aa1..82638507 100644
--- a/test/test_configuration.py
+++ b/test/test_configuration.py
@@ -21,6 +21,15 @@ class TestUnitConfiguration(unit.TestUnitControl):
}
""", '/applications'), 'unicode')
+ self.assertDictEqual(self.conf_get('/applications'), {
+ "app": {
+ "type": "python",
+ "processes": { "spare": 0 },
+ "path": "/app",
+ "module": "wsgi"
+ }
+ }, 'unicode get')
+
def test_json_unicode_2(self):
self.assertIn('success', self.conf({
"приложение": {
@@ -31,6 +40,9 @@ class TestUnitConfiguration(unit.TestUnitControl):
}
}, '/applications'), 'unicode 2')
+ self.assertIn('приложение', self.conf_get('/applications'),
+ 'unicode 2 get')
+
def test_json_unicode_number(self):
self.assertIn('error', self.conf(b"""
{
@@ -49,16 +61,6 @@ class TestUnitConfiguration(unit.TestUnitControl):
def test_applications_string(self):
self.assertIn('error', self.conf('"{}"', '/applications'), 'string')
- def test_negative_spare(self):
- self.assertIn('error', self.conf({
- "app": {
- "type": "python",
- "processes": { "spare": -1 },
- "path": "/app",
- "module": "wsgi"
- }
- }, '/applications'), 'negative spare')
-
def test_applications_type_only(self):
self.assertIn('error', self.conf({
"app": {
diff --git a/test/test_python_procman.py b/test/test_python_procman.py
index f1187795..a2113f71 100644
--- a/test/test_python_procman.py
+++ b/test/test_python_procman.py
@@ -36,6 +36,22 @@ class TestUnitPythonProcman(unit.TestUnitApplicationPython):
self.assertIn('error', self.conf_get('/applications/' + self.app_name +
'/processes/idle_timeout'), 'idle_timeout no access')
+ def test_python_processes_spare_negative(self):
+ self.assertIn('error', self.conf({
+ "spare": -1
+ }, '/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')
+
+ def test_python_processes_idle_timeout_negative(self):
+ self.assertIn('error', self.conf({
+ "idle_timeout": -1
+ }, '/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'),
diff --git a/test/unit.py b/test/unit.py
index 8e7ba105..f6514a49 100644
--- a/test/unit.py
+++ b/test/unit.py
@@ -192,7 +192,7 @@ class TestUnitHTTP(TestUnit):
resp = self._recvall(sock)
if '--verbose' in sys.argv:
- print('<<<', resp, sep='\n')
+ print('<<<', resp.encode('utf-8'), sep='\n')
if 'raw_resp' not in kwargs:
resp = self._resp_to_dict(resp)