Skip to content

Commit fb95083

Browse files
committed
Simplify url setting based on suggestions
1 parent 8a58936 commit fb95083

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

tests/webservice_test.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def test_bad_ip_address(self):
145145

146146
def test_no_body_error(self):
147147
self.httpserver.expect_request(
148-
"/geoip/v2.1/country/" + "1.2.3.7"
148+
"/geoip/v2.1/country/1.2.3.7"
149149
).respond_with_data(
150150
"",
151151
status=400,
@@ -159,7 +159,7 @@ def test_no_body_error(self):
159159
def test_weird_body_error(self):
160160

161161
self.httpserver.expect_request(
162-
"/geoip/v2.1/country/" + "1.2.3.8"
162+
"/geoip/v2.1/country/1.2.3.8"
163163
).respond_with_json(
164164
{"wierd": 42},
165165
status=400,
@@ -175,7 +175,7 @@ def test_weird_body_error(self):
175175
def test_bad_body_error(self):
176176

177177
self.httpserver.expect_request(
178-
"/geoip/v2.1/country/" + "1.2.3.9"
178+
"/geoip/v2.1/country/1.2.3.9"
179179
).respond_with_data(
180180
"bad body",
181181
status=400,
@@ -188,7 +188,7 @@ def test_bad_body_error(self):
188188

189189
def test_500_error(self):
190190
self.httpserver.expect_request(
191-
"/geoip/v2.1/country/" + "1.2.3.10"
191+
"/geoip/v2.1/country/1.2.3.10"
192192
).respond_with_data(
193193
"",
194194
status=500,
@@ -200,7 +200,7 @@ def test_500_error(self):
200200
def test_300_error(self):
201201

202202
self.httpserver.expect_request(
203-
"/geoip/v2.1/country/" + "1.2.3.11"
203+
"/geoip/v2.1/country/1.2.3.11"
204204
).respond_with_data(
205205
"",
206206
status=300,
@@ -248,7 +248,7 @@ def _test_error(self, status, error_code, error_class):
248248
msg = "Some error message"
249249
body = {"error": msg, "code": error_code}
250250
self.httpserver.expect_request(
251-
"/geoip/v2.1/country/" + "1.2.3.18"
251+
"/geoip/v2.1/country/1.2.3.18"
252252
).respond_with_json(
253253
body,
254254
status=status,
@@ -279,7 +279,7 @@ def custom_handler(r):
279279
return ""
280280

281281
self.httpserver.expect_request(
282-
"/geoip/v2.1/country/" + "1.2.3.4"
282+
"/geoip/v2.1/country/1.2.3.4"
283283
).respond_with_handler(custom_handler)
284284
try:
285285
self.run_client(self.client.country("1.2.3.4"))
@@ -319,7 +319,7 @@ def test_city_ok(self):
319319

320320
def test_insights_ok(self):
321321
self.httpserver.expect_request(
322-
"/geoip/v2.1/insights/" + "1.2.3.4"
322+
"/geoip/v2.1/insights/1.2.3.4"
323323
).respond_with_json(
324324
self.insights,
325325
status=200,
@@ -355,7 +355,7 @@ class TestClient(TestBaseClient):
355355
def setUp(self):
356356
self.client_class = Client
357357
self.client = Client(42, "abcdef123456")
358-
self.client._base_uri = self.httpserver.url_for("/") + "geoip/v2.1"
358+
self.client._base_uri = self.httpserver.url_for("/geoip/v2.1")
359359

360360
def run_client(self, v):
361361
return v
@@ -366,7 +366,7 @@ def setUp(self):
366366
self._loop = asyncio.new_event_loop()
367367
self.client_class = AsyncClient
368368
self.client = AsyncClient(42, "abcdef123456")
369-
self.client._base_uri = self.httpserver.url_for("/") + "geoip/v2.1"
369+
self.client._base_uri = self.httpserver.url_for("/geoip/v2.1")
370370

371371
def tearDown(self):
372372
self._loop.run_until_complete(self.client.close())

0 commit comments

Comments
 (0)