@@ -146,10 +146,9 @@ def test_get(self):
146
146
self .assertEqual (response .status_code , 200 )
147
147
data = json .loads (response .data .decode ('utf-8' ))
148
148
self .assertEqual (data ['args' ], {})
149
- self .assertEqual (data ['headers' ]['Host' ], 'localhost' )
150
149
self .assertEqual (data ['headers' ]['User-Agent' ], 'test' )
151
150
# self.assertEqual(data['origin'], None)
152
- self .assertEqual (data ['url' ], 'http://localhost/ get' )
151
+ self .assertRegex (data ['url' ], '^ http://[^/]*/ get$ ' )
153
152
self .assertTrue (response .data .endswith (b'\n ' ))
154
153
155
154
def test_anything (self ):
@@ -159,8 +158,7 @@ def test_anything(self):
159
158
self .assertEqual (response .status_code , 200 )
160
159
data = json .loads (response .data .decode ('utf-8' ))
161
160
self .assertEqual (data ['args' ], {})
162
- self .assertEqual (data ['headers' ]['Host' ], 'localhost' )
163
- self .assertEqual (data ['url' ], 'http://localhost/anything/foo/bar' )
161
+ self .assertRegex (data ['url' ], '^http://[^/]*/anything/foo/bar$' )
164
162
self .assertEqual (data ['method' ], 'GET' )
165
163
self .assertTrue (response .data .endswith (b'\n ' ))
166
164
@@ -581,8 +579,8 @@ def test_redirect_to_post(self):
581
579
582
580
def test_redirect_absolute_param_n_higher_than_1 (self ):
583
581
response = self .app .get ('/redirect/5?absolute=true' )
584
- self .assertEqual (
585
- response .headers .get ('Location' ), 'http://localhost/ absolute-redirect/4'
582
+ self .assertRegex (
583
+ response .headers .get ('Location' ), '^ http://[^/]*/ absolute-redirect/4$ '
586
584
)
587
585
588
586
def test_redirect_n_equals_to_1 (self ):
@@ -607,15 +605,15 @@ def test_relative_redirect_n_higher_than_1(self):
607
605
608
606
def test_absolute_redirect_n_higher_than_1 (self ):
609
607
response = self .app .get ('/absolute-redirect/5' )
610
- self .assertEqual (
611
- response .headers .get ('Location' ), 'http://localhost/ absolute-redirect/4'
608
+ self .assertRegex (
609
+ response .headers .get ('Location' ), '^ http://[^/]*/ absolute-redirect/4$ '
612
610
)
613
611
614
612
def test_absolute_redirect_n_equals_to_1 (self ):
615
613
response = self .app .get ('/absolute-redirect/1' )
616
614
self .assertEqual (response .status_code , 302 )
617
- self .assertEqual (
618
- response .headers .get ('Location' ), 'http://localhost/ get'
615
+ self .assertRegex (
616
+ response .headers .get ('Location' ), '^ http://[^/]*/ get$ '
619
617
)
620
618
621
619
def test_request_range (self ):
0 commit comments