summaryrefslogtreecommitdiffhomepage
path: root/test/test_php_application.py
diff options
context:
space:
mode:
authorAndrey Zelenkov <zelenkov@nginx.com>2018-07-11 19:35:46 +0300
committerAndrey Zelenkov <zelenkov@nginx.com>2018-07-11 19:35:46 +0300
commit96a4f9f032de2ee385ba84bb3c31b437e9814686 (patch)
treede9881059ed1615e52d2c9845bf54a7ba8482fff /test/test_php_application.py
parent223ba37ab5d81fc5f0d2ddb9a632f0d9c4db6a10 (diff)
downloadunit-96a4f9f032de2ee385ba84bb3c31b437e9814686.tar.gz
unit-96a4f9f032de2ee385ba84bb3c31b437e9814686.tar.bz2
Tests: more php.ini options tests.
Diffstat (limited to 'test/test_php_application.py')
-rw-r--r--test/test_php_application.py74
1 files changed, 74 insertions, 0 deletions
diff --git a/test/test_php_application.py b/test/test_php_application.py
index 37467019..c8ae8ad0 100644
--- a/test/test_php_application.py
+++ b/test/test_php_application.py
@@ -130,5 +130,79 @@ class TestUnitPHPApplication(unit.TestUnitApplicationPHP):
self.current_dir + '/php/ini_precision/php.ini', 'ini file')
self.assertEqual(self.get()['headers']['X-Precision'], '4', 'ini value')
+ @unittest.expectedFailure
+ def test_php_application_ini_admin_user(self):
+ self.load('ini_precision')
+
+ self.assertIn('error', self.conf({
+ "user": { "precision": "4" },
+ "admin": { "precision": "5" }
+ }, '/applications/ini_precision/options'), 'ini admin user')
+
+ def test_php_application_ini_admin(self):
+ self.load('ini_precision')
+
+ self.conf({
+ "file": "php.ini",
+ "admin": { "precision": "5" }
+ }, '/applications/ini_precision/options')
+
+ self.assertEqual(self.get()['headers']['X-Precision'], '5',
+ 'ini value admin')
+
+ def test_php_application_ini_user(self):
+ self.load('ini_precision')
+
+ self.conf({
+ "file": "php.ini",
+ "user": { "precision": "5" }
+ }, '/applications/ini_precision/options')
+
+ self.assertEqual(self.get()['headers']['X-Precision'], '5',
+ 'ini value user')
+
+ def test_php_application_ini_user_2(self):
+ self.load('ini_precision')
+
+ 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')
+
+ self.assertEqual(self.get()['headers']['X-Precision'], '5',
+ 'ini value user')
+
+ def test_php_application_ini_set_admin(self):
+ self.load('ini_precision')
+
+ self.conf({"admin": { "precision": "5" }},
+ '/applications/ini_precision/options')
+
+ self.assertEqual(self.get(url='/?precision=6')['headers']['X-Precision'],
+ '5', 'ini set admin')
+
+ def test_php_application_ini_set_user(self):
+ self.load('ini_precision')
+
+ self.conf({"user": { "precision": "5" }},
+ '/applications/ini_precision/options')
+
+ self.assertEqual(self.get(url='/?precision=6')['headers']['X-Precision'],
+ '6', 'ini set user')
+
+ def test_php_application_ini_repeat(self):
+ self.load('ini_precision')
+
+ self.conf({"user": { "precision": "5" }},
+ '/applications/ini_precision/options')
+
+ self.assertEqual(self.get()['headers']['X-Precision'], '5', 'ini value')
+
+ self.assertEqual(self.get()['headers']['X-Precision'], '5',
+ 'ini value repeat')
+
if __name__ == '__main__':
unittest.main()