File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change 102102"""
103103
104104
105+ TESTBLOCK_CASE_5 = """
106+ upstream test0 {
107+ server 1.1.1.1:8080;
108+ send "some request";
109+ }
110+
111+ upstream test1 {
112+ server 1.1.1.1:8080;
113+ send 'some request';
114+ }
115+
116+ server {
117+ server_name "www.example.com";
118+
119+ location / {
120+ root html;
121+ }
122+ }
123+ """
124+
125+
126+ TESTBLOCK_CASE_6 = """
127+ upstream test0 {
128+ server 1.1.1.1:8080;
129+ check interval=3000 rise=2 fall=3 timeout=3000 type=http;
130+ check_http_send "GET /alive.html HTTP/1.0\r \n \r \n ";
131+ check_http_expect_alive http_2xx http_3xx;
132+ }
133+
134+ upstream test1 {
135+ ip_hash;
136+ server 2.2.2.2:9000;
137+ check_http_send 'GET /alive.html HTTP/1.0\r \n \r \n ';
138+ }
139+ """
140+
141+
105142class TestPythonNginx (unittest .TestCase ):
106143 def test_basic_load (self ):
107144 self .assertTrue (nginx .loads (TESTBLOCK_CASE_1 ) is not None )
@@ -166,6 +203,16 @@ def test_reflection(self):
166203 out_data = '\n ' + nginx .dumps (inp_data )
167204 self .assertEqual (TESTBLOCK_CASE_1 , out_data )
168205
206+ def test_quoted_key_value (self ):
207+ data = nginx .loads (TESTBLOCK_CASE_5 )
208+ out_data = '\n ' + nginx .dumps (data )
209+ self .assertEqual (out_data , TESTBLOCK_CASE_5 )
210+
211+ def test_complex_upstream (self ):
212+ inp_data = nginx .loads (TESTBLOCK_CASE_6 )
213+ out_data = '\n ' + nginx .dumps (inp_data )
214+ self .assertEqual (TESTBLOCK_CASE_6 , out_data )
215+
169216 def test_filtering (self ):
170217 data = nginx .loads (TESTBLOCK_CASE_1 )
171218 self .assertEqual (len (data .server .filter ('Key' , 'mykey' )), 1 )
You can’t perform that action at this time.
0 commit comments