Skip to content

Commit b04ff2d

Browse files
author
Jacob Cook
committed
Minor test improvement
1 parent 6c3d18d commit b04ff2d

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

tests.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
Licensed under GPLv3, see LICENSE.md
77
"""
88

9+
# flake8: noqa
10+
911
import nginx
1012
import unittest
1113

@@ -30,11 +32,11 @@
3032
"""
3133

3234
SECONDTESTBLOCK = """
33-
upstream php
35+
upstream php
3436
{
3537
server unix:/tmp/php-fcgi.socket;
3638
}
37-
server
39+
server
3840
{
3941
listen 80; # This comment should be present;
4042
# And this one
@@ -54,7 +56,7 @@
5456
location ~ \.php(?:$|/) {
5557
fastcgi_pass php;
5658
}
57-
59+
5860
# location from the issue #10
5961
location / {
6062
return 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

Comments
 (0)