6
6
Licensed under GPLv3, see LICENSE.md
7
7
"""
8
8
9
+ # flake8: noqa
10
+
9
11
import nginx
10
12
import unittest
11
13
30
32
"""
31
33
32
34
SECONDTESTBLOCK = """
33
- upstream php
35
+ upstream php
34
36
{
35
37
server unix:/tmp/php-fcgi.socket;
36
38
}
37
- server
39
+ server
38
40
{
39
41
listen 80; # This comment should be present;
40
42
# And this one
54
56
location ~ \.php(?:$|/) {
55
57
fastcgi_pass php;
56
58
}
57
-
59
+
58
60
# location from the issue #10
59
61
location / {
60
62
return 301 $scheme://$host:$server_port${request_uri}bitbucket/;
@@ -97,7 +99,7 @@ def test_key_parse(self):
97
99
self .assertEqual (thirdKey .name , 'mykey' )
98
100
self .assertEqual (thirdKey .value , '"myvalue; #notme myothervalue"' )
99
101
100
- def test_key_parse_testblock2 (self ):
102
+ def test_key_parse_complex (self ):
101
103
data = nginx .loads (SECONDTESTBLOCK )
102
104
self .assertEqual (len (data .server .keys ), 5 )
103
105
firstKey = data .server .keys [0 ]
@@ -106,6 +108,10 @@ def test_key_parse_testblock2(self):
106
108
self .assertEqual (firstKey .value , '80' )
107
109
self .assertEqual (thirdKey .name , 'mykey' )
108
110
self .assertEqual (thirdKey .value , '"myvalue; #notme myothervalue"' )
111
+ self .assertEqual (
112
+ data .server .locations [- 1 ].keys [0 ].value ,
113
+ "301 $scheme://$host:$server_port${request_uri}bitbucket/"
114
+ )
109
115
110
116
def test_location_parse (self ):
111
117
data = nginx .loads (TESTBLOCK )
0 commit comments