test_php_basic.py (1596:b7e2d4d92624) test_php_basic.py (1775:4b4991514356)
1from unit.control import TestControl
2
3
4class TestPHPBasic(TestControl):
5 prerequisites = {'modules': {'php': 'any'}}
6
7 conf_app = {
8 "app": {

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

14 }
15
16 conf_basic = {
17 "listeners": {"*:7080": {"pass": "applications/app"}},
18 "applications": conf_app,
19 }
20
21 def test_php_get_applications(self):
1from unit.control import TestControl
2
3
4class TestPHPBasic(TestControl):
5 prerequisites = {'modules': {'php': 'any'}}
6
7 conf_app = {
8 "app": {

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

14 }
15
16 conf_basic = {
17 "listeners": {"*:7080": {"pass": "applications/app"}},
18 "applications": conf_app,
19 }
20
21 def test_php_get_applications(self):
22 self.conf(self.conf_app, 'applications')
22 assert 'success' in self.conf(self.conf_app, 'applications')
23
24 conf = self.conf_get()
25
26 assert conf['listeners'] == {}, 'listeners'
27 assert conf['applications'] == {
28 "app": {
29 "type": "php",
30 "processes": {"spare": 0},

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

50 }, 'applications prefix 2'
51
52 assert self.conf_get('applications/app/type') == 'php', 'type'
53 assert (
54 self.conf_get('applications/app/processes/spare') == 0
55 ), 'spare processes'
56
57 def test_php_get_listeners(self):
23
24 conf = self.conf_get()
25
26 assert conf['listeners'] == {}, 'listeners'
27 assert conf['applications'] == {
28 "app": {
29 "type": "php",
30 "processes": {"spare": 0},

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

50 }, 'applications prefix 2'
51
52 assert self.conf_get('applications/app/type') == 'php', 'type'
53 assert (
54 self.conf_get('applications/app/processes/spare') == 0
55 ), 'spare processes'
56
57 def test_php_get_listeners(self):
58 self.conf(self.conf_basic)
58 assert 'success' in self.conf(self.conf_basic)
59
60 assert self.conf_get()['listeners'] == {
61 "*:7080": {"pass": "applications/app"}
62 }, 'listeners'
63
64 assert self.conf_get('listeners') == {
65 "*:7080": {"pass": "applications/app"}
66 }, 'listeners prefix'
67
68 assert self.conf_get('listeners/*:7080') == {
69 "pass": "applications/app"
70 }, 'listeners prefix 2'
71
72 def test_php_change_listener(self):
59
60 assert self.conf_get()['listeners'] == {
61 "*:7080": {"pass": "applications/app"}
62 }, 'listeners'
63
64 assert self.conf_get('listeners') == {
65 "*:7080": {"pass": "applications/app"}
66 }, 'listeners prefix'
67
68 assert self.conf_get('listeners/*:7080') == {
69 "pass": "applications/app"
70 }, 'listeners prefix 2'
71
72 def test_php_change_listener(self):
73 self.conf(self.conf_basic)
74 self.conf({"*:7081": {"pass": "applications/app"}}, 'listeners')
73 assert 'success' in self.conf(self.conf_basic)
74 assert 'success' in self.conf(
75 {"*:7081": {"pass": "applications/app"}}, 'listeners'
76 )
75
76 assert self.conf_get('listeners') == {
77 "*:7081": {"pass": "applications/app"}
78 }, 'change listener'
79
80 def test_php_add_listener(self):
77
78 assert self.conf_get('listeners') == {
79 "*:7081": {"pass": "applications/app"}
80 }, 'change listener'
81
82 def test_php_add_listener(self):
81 self.conf(self.conf_basic)
82 self.conf({"pass": "applications/app"}, 'listeners/*:7082')
83 assert 'success' in self.conf(self.conf_basic)
84 assert 'success' in self.conf(
85 {"pass": "applications/app"}, 'listeners/*:7082'
86 )
83
84 assert self.conf_get('listeners') == {
85 "*:7080": {"pass": "applications/app"},
86 "*:7082": {"pass": "applications/app"},
87 }, 'add listener'
88
89 def test_php_change_application(self):
87
88 assert self.conf_get('listeners') == {
89 "*:7080": {"pass": "applications/app"},
90 "*:7082": {"pass": "applications/app"},
91 }, 'add listener'
92
93 def test_php_change_application(self):
90 self.conf(self.conf_basic)
94 assert 'success' in self.conf(self.conf_basic)
91
95
92 self.conf('30', 'applications/app/processes/max')
96 assert 'success' in self.conf('30', 'applications/app/processes/max')
93 assert (
94 self.conf_get('applications/app/processes/max') == 30
95 ), 'change application max'
96
97 assert (
98 self.conf_get('applications/app/processes/max') == 30
99 ), 'change application max'
100
97 self.conf('"/www"', 'applications/app/root')
101 assert 'success' in self.conf('"/www"', 'applications/app/root')
98 assert (
99 self.conf_get('applications/app/root') == '/www'
100 ), 'change application root'
101
102 def test_php_delete(self):
102 assert (
103 self.conf_get('applications/app/root') == '/www'
104 ), 'change application root'
105
106 def test_php_delete(self):
103 self.conf(self.conf_basic)
107 assert 'success' in self.conf(self.conf_basic)
104
105 assert 'error' in self.conf_delete('applications/app')
106 assert 'success' in self.conf_delete('listeners/*:7080')
107 assert 'success' in self.conf_delete('applications/app')
108 assert 'error' in self.conf_delete('applications/app')
109
110 def test_php_delete_blocks(self):
108
109 assert 'error' in self.conf_delete('applications/app')
110 assert 'success' in self.conf_delete('listeners/*:7080')
111 assert 'success' in self.conf_delete('applications/app')
112 assert 'error' in self.conf_delete('applications/app')
113
114 def test_php_delete_blocks(self):
111 self.conf(self.conf_basic)
115 assert 'success' in self.conf(self.conf_basic)
112
113 assert 'success' in self.conf_delete('listeners')
114 assert 'success' in self.conf_delete('applications')
115
116 assert 'success' in self.conf(self.conf_app, 'applications')
117 assert 'success' in self.conf(
118 {"*:7081": {"pass": "applications/app"}}, 'listeners'
119 ), 'applications restore'
116
117 assert 'success' in self.conf_delete('listeners')
118 assert 'success' in self.conf_delete('applications')
119
120 assert 'success' in self.conf(self.conf_app, 'applications')
121 assert 'success' in self.conf(
122 {"*:7081": {"pass": "applications/app"}}, 'listeners'
123 ), 'applications restore'