66Licensed under GPLv3, see LICENSE.md
77"""
88
9+ # flake8: noqa
10+
911import nginx
1012import unittest
1113
3032"""
3133
3234SECONDTESTBLOCK = """
33- upstream php
35+ upstream php
3436{
3537 server unix:/tmp/php-fcgi.socket;
3638}
37- server
39+ server
3840{
3941listen 80; # This comment should be present;
4042 # And this one
5456 location ~ \.php(?:$|/) {
5557 fastcgi_pass php;
5658 }
57-
59+
5860 # location from the issue #10
5961 location / {
6062return 301 $scheme://$host:$server_port${request_uri}bitbucket/;
@@ -97,7 +99,7 @@ def test_key_parse(self):
9799 self .assertEqual (thirdKey .name , 'mykey' )
98100 self .assertEqual (thirdKey .value , '"myvalue; #notme myothervalue"' )
99101
100- def test_key_parse_testblock2 (self ):
102+ def test_key_parse_complex (self ):
101103 data = nginx .loads (SECONDTESTBLOCK )
102104 self .assertEqual (len (data .server .keys ), 5 )
103105 firstKey = data .server .keys [0 ]
@@ -106,6 +108,10 @@ def test_key_parse_testblock2(self):
106108 self .assertEqual (firstKey .value , '80' )
107109 self .assertEqual (thirdKey .name , 'mykey' )
108110 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+ )
109115
110116 def test_location_parse (self ):
111117 data = nginx .loads (TESTBLOCK )
0 commit comments