test_php_basic.py (1165:998b521bbdb8) test_php_basic.py (1453:71af60a59338)
1from unit.control import TestControl
2
3
4class TestPHPBasic(TestControl):
5 prerequisites = {'modules': ['php']}
6
7 conf_app = {
8 "app": {

--- 23 unchanged lines hidden (view full) ---

32 "processes": {"spare": 0},
33 "root": "/app",
34 "index": "index.php",
35 }
36 },
37 'applications',
38 )
39
1from unit.control import TestControl
2
3
4class TestPHPBasic(TestControl):
5 prerequisites = {'modules': ['php']}
6
7 conf_app = {
8 "app": {

--- 23 unchanged lines hidden (view full) ---

32 "processes": {"spare": 0},
33 "root": "/app",
34 "index": "index.php",
35 }
36 },
37 'applications',
38 )
39
40 def test_php_get_applications_prefix(self):
41 self.conf(self.conf_app, 'applications')
42
43 self.assertEqual(
44 self.conf_get('applications'),
45 {
46 "app": {
47 "type": "php",
48 "processes": {"spare": 0},
49 "root": "/app",
50 "index": "index.php",
51 }
52 },
53 'applications prefix',
54 )
55
40 self.assertEqual(
41 self.conf_get('applications'),
42 {
43 "app": {
44 "type": "php",
45 "processes": {"spare": 0},
46 "root": "/app",
47 "index": "index.php",
48 }
49 },
50 'applications prefix',
51 )
52
56 def test_php_get_applications_prefix_2(self):
57 self.conf(self.conf_app, 'applications')
58
59 self.assertEqual(
60 self.conf_get('applications/app'),
61 {
62 "type": "php",
63 "processes": {"spare": 0},
64 "root": "/app",
65 "index": "index.php",
66 },
67 'applications prefix 2',
68 )
69
53 self.assertEqual(
54 self.conf_get('applications/app'),
55 {
56 "type": "php",
57 "processes": {"spare": 0},
58 "root": "/app",
59 "index": "index.php",
60 },
61 'applications prefix 2',
62 )
63
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', 'type')
74 self.assertEqual(
75 self.conf_get('applications/app/processes/spare'),
76 0,
77 'spare processes',
78 )
79
80 def test_php_get_listeners(self):
81 self.conf(self.conf_basic)
82
83 self.assertEqual(
84 self.conf_get()['listeners'],
85 {"*:7080": {"pass": "applications/app"}},
86 'listeners',
87 )
88
64 self.assertEqual(self.conf_get('applications/app/type'), 'php', 'type')
65 self.assertEqual(
66 self.conf_get('applications/app/processes/spare'),
67 0,
68 'spare processes',
69 )
70
71 def test_php_get_listeners(self):
72 self.conf(self.conf_basic)
73
74 self.assertEqual(
75 self.conf_get()['listeners'],
76 {"*:7080": {"pass": "applications/app"}},
77 'listeners',
78 )
79
89 def test_php_get_listeners_prefix(self):
90 self.conf(self.conf_basic)
91
92 self.assertEqual(
93 self.conf_get('listeners'),
94 {"*:7080": {"pass": "applications/app"}},
95 'listeners prefix',
96 )
97
80 self.assertEqual(
81 self.conf_get('listeners'),
82 {"*:7080": {"pass": "applications/app"}},
83 'listeners prefix',
84 )
85
98 def test_php_get_listeners_prefix_2(self):
99 self.conf(self.conf_basic)
100
101 self.assertEqual(
102 self.conf_get('listeners/*:7080'),
103 {"pass": "applications/app"},
104 'listeners prefix 2',
105 )
106
107 def test_php_change_listener(self):
108 self.conf(self.conf_basic)

--- 33 unchanged lines hidden (view full) ---

142 self.conf_get('applications/app/root'),
143 '/www',
144 'change application root',
145 )
146
147 def test_php_delete(self):
148 self.conf(self.conf_basic)
149
86 self.assertEqual(
87 self.conf_get('listeners/*:7080'),
88 {"pass": "applications/app"},
89 'listeners prefix 2',
90 )
91
92 def test_php_change_listener(self):
93 self.conf(self.conf_basic)

--- 33 unchanged lines hidden (view full) ---

127 self.conf_get('applications/app/root'),
128 '/www',
129 'change application root',
130 )
131
132 def test_php_delete(self):
133 self.conf(self.conf_basic)
134
150 self.assertIn(
151 'error',
152 self.conf_delete('applications/app'),
153 'delete app before listener',
154 )
155 self.assertIn(
156 'success', self.conf_delete('listeners/*:7080'), 'delete listener'
157 )
158 self.assertIn(
159 'success',
160 self.conf_delete('applications/app'),
161 'delete app after listener',
162 )
163 self.assertIn(
164 'error', self.conf_delete('applications/app'), 'delete app again'
165 )
135 self.assertIn('error', self.conf_delete('applications/app'))
136 self.assertIn('success', self.conf_delete('listeners/*:7080'))
137 self.assertIn('success', self.conf_delete('applications/app'))
138 self.assertIn('error', self.conf_delete('applications/app'))
166
167 def test_php_delete_blocks(self):
168 self.conf(self.conf_basic)
169
139
140 def test_php_delete_blocks(self):
141 self.conf(self.conf_basic)
142
170 self.assertIn(
171 'success',
172 self.conf_delete('listeners'),
173 'listeners delete',
174 )
143 self.assertIn('success', self.conf_delete('listeners'))
144 self.assertIn('success', self.conf_delete('applications'))
175
145
146 self.assertIn('success', self.conf(self.conf_app, 'applications'))
176 self.assertIn(
177 'success',
147 self.assertIn(
148 'success',
178 self.conf_delete('applications'),
179 'applications delete',
180 )
181
182 self.assertIn(
183 'success',
184 self.conf(self.conf_app, 'applications'),
185 'listeners restore',
186 )
187
188 self.assertIn(
189 'success',
190 self.conf({"*:7081": {"pass": "applications/app"}}, 'listeners'),
191 'applications restore',
192 )
193
149 self.conf({"*:7081": {"pass": "applications/app"}}, 'listeners'),
150 'applications restore',
151 )
152
153
194if __name__ == '__main__':
195 TestPHPBasic.main()
154if __name__ == '__main__':
155 TestPHPBasic.main()