File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 22# -*- coding: utf-8 -*-
33
44import httpretty
5+ import httpretty .core
56import sys
67sys .path .append ('..' )
78
@@ -168,17 +169,19 @@ def test_request(self):
168169 body = json .dumps (self .country ),
169170 status = 200 )
170171 country = self .client .country ('1.2.3.4' )
171- args , kwargs = get .call_args
172- self .assertEqual (args [0 ], 'https://geoip.maxmind.com'
172+ request = httpretty .core .httpretty .latest_requests [- 1 ]
173+
174+ self .assertEqual (request .path ,
173175 '/geoip/v2.0/country/1.2.3.4' ,
174176 'correct URI is used' )
175- self .assertEqual (kwargs . get ( ' headers' ). get ( ' Accept') ,
177+ self .assertEqual (request . headers [ ' Accept'] ,
176178 'application/json' ,
177179 'correct Accept header' )
178- self .assertRegex (kwargs . get ( ' headers' ). get ( ' User-Agent') ,
180+ self .assertRegex (request . headers [ ' User-Agent'] ,
179181 '^GeoIP2 Python Client v' ,
180182 'Correct User-Agent' )
181- self .assertEqual (kwargs .get ('auth' ), (42 , 'abcdef123456' ))
183+ self .assertEqual (request .headers ['Authorization' ],
184+ 'Basic NDI6YWJjZGVmMTIzNDU2' , 'correct auth' )
182185
183186 def test_city_ok (self ):
184187 httpretty .register_uri (httpretty .GET ,
You can’t perform that action at this time.
0 commit comments