Deleted
Added
test_php_basic.py (504:e9ebde982898) | test_php_basic.py (507:fa714d76592b) |
---|---|
1import unittest 2import unit 3 4class TestUnitBasic(unit.TestUnitControl): 5 6 def setUpClass(): 7 unit.TestUnit().check_modules('php') 8 9 conf_app = { 10 "app": { 11 "type": "php", | 1import unittest 2import unit 3 4class TestUnitBasic(unit.TestUnitControl): 5 6 def setUpClass(): 7 unit.TestUnit().check_modules('php') 8 9 conf_app = { 10 "app": { 11 "type": "php", |
12 "workers": 1, | 12 "processes": { "spare": 0 }, |
13 "root": "/app", 14 "index": "index.php" 15 } 16 } 17 18 conf_basic = { 19 "listeners": { 20 "*:7080": { --- 8 unchanged lines hidden (view full) --- 29 30 conf = self.conf_get() 31 32 self.assertEqual(conf['listeners'], {}, 'listeners') 33 self.assertEqual(conf['applications'], 34 { 35 "app": { 36 "type": "php", | 13 "root": "/app", 14 "index": "index.php" 15 } 16 } 17 18 conf_basic = { 19 "listeners": { 20 "*:7080": { --- 8 unchanged lines hidden (view full) --- 29 30 conf = self.conf_get() 31 32 self.assertEqual(conf['listeners'], {}, 'listeners') 33 self.assertEqual(conf['applications'], 34 { 35 "app": { 36 "type": "php", |
37 "workers": 1, | 37 "processes": { "spare": 0 }, |
38 "root": "/app", 39 "index": "index.php" 40 } 41 }, 42 'applications') 43 44 def test_php_get_applications_prefix(self): 45 self.conf(self.conf_app, '/applications') 46 47 self.assertEqual(self.conf_get('/applications'), 48 { 49 "app": { 50 "type": "php", | 38 "root": "/app", 39 "index": "index.php" 40 } 41 }, 42 'applications') 43 44 def test_php_get_applications_prefix(self): 45 self.conf(self.conf_app, '/applications') 46 47 self.assertEqual(self.conf_get('/applications'), 48 { 49 "app": { 50 "type": "php", |
51 "workers": 1, | 51 "processes": { "spare": 0 }, |
52 "root": "/app", 53 "index": "index.php" 54 } 55 }, 56 'applications prefix') 57 58 def test_php_get_applications_prefix_2(self): 59 self.conf(self.conf_app, '/applications') 60 61 self.assertEqual(self.conf_get('/applications/app'), 62 { 63 "type": "php", | 52 "root": "/app", 53 "index": "index.php" 54 } 55 }, 56 'applications prefix') 57 58 def test_php_get_applications_prefix_2(self): 59 self.conf(self.conf_app, '/applications') 60 61 self.assertEqual(self.conf_get('/applications/app'), 62 { 63 "type": "php", |
64 "workers": 1, | 64 "processes": { "spare": 0 }, |
65 "root": "/app", 66 "index": "index.php" 67 }, 68 'applications prefix 2') 69 70 def test_php_get_applications_prefix_3(self): 71 self.conf(self.conf_app, '/applications') 72 73 self.assertEqual(self.conf_get('/applications/app/type'), 'php', 74 'type') | 65 "root": "/app", 66 "index": "index.php" 67 }, 68 'applications prefix 2') 69 70 def test_php_get_applications_prefix_3(self): 71 self.conf(self.conf_app, '/applications') 72 73 self.assertEqual(self.conf_get('/applications/app/type'), 'php', 74 'type') |
75 self.assertEqual(self.conf_get('/applications/app/workers'), 1, 76 'workers') | 75 self.assertEqual(self.conf_get('/applications/app/processes/spare'), 0, 76 'spare processes') |
77 78 def test_php_get_listeners(self): 79 self.conf(self.conf_basic) 80 81 self.assertEqual(self.conf_get()['listeners'], 82 {"*:7080":{"application":"app"}}, 'listeners') 83 84 def test_php_get_listeners_prefix(self): --- 28 unchanged lines hidden (view full) --- 113 "application": "app" 114 } 115 }, 116 'add listener') 117 118 def test_php_change_application(self): 119 self.conf(self.conf_basic) 120 | 77 78 def test_php_get_listeners(self): 79 self.conf(self.conf_basic) 80 81 self.assertEqual(self.conf_get()['listeners'], 82 {"*:7080":{"application":"app"}}, 'listeners') 83 84 def test_php_get_listeners_prefix(self): --- 28 unchanged lines hidden (view full) --- 113 "application": "app" 114 } 115 }, 116 'add listener') 117 118 def test_php_change_application(self): 119 self.conf(self.conf_basic) 120 |
121 self.conf('30', '/applications/app/workers') 122 self.assertEqual(self.conf_get('/applications/app/workers'), 30, 123 'change application workers') | 121 self.conf('30', '/applications/app/processes/max') 122 self.assertEqual(self.conf_get('/applications/app/processes/max'), 30, 123 'change application max') |
124 125 self.conf('"/www"', '/applications/app/root') 126 self.assertEqual(self.conf_get('/applications/app/root'), '/www', 127 'change application root') 128 129 def test_php_delete(self): 130 self.conf(self.conf_basic) 131 132 self.assertIn('error', self.conf_delete('/applications/app'), 133 'delete app before listener') 134 self.assertIn('success', self.conf_delete('/listeners/*:7080'), 135 'delete listener') 136 self.assertIn('success', self.conf_delete('/applications/app'), 137 'delete app after listener') 138 self.assertIn('error', self.conf_delete('/applications/app'), 139 'delete app again') 140 141if __name__ == '__main__': 142 unittest.main() | 124 125 self.conf('"/www"', '/applications/app/root') 126 self.assertEqual(self.conf_get('/applications/app/root'), '/www', 127 'change application root') 128 129 def test_php_delete(self): 130 self.conf(self.conf_basic) 131 132 self.assertIn('error', self.conf_delete('/applications/app'), 133 'delete app before listener') 134 self.assertIn('success', self.conf_delete('/listeners/*:7080'), 135 'delete listener') 136 self.assertIn('success', self.conf_delete('/applications/app'), 137 'delete app after listener') 138 self.assertIn('error', self.conf_delete('/applications/app'), 139 'delete app again') 140 141if __name__ == '__main__': 142 unittest.main() |