Skip to content

Commit

Permalink
Simplify url setting based on suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
shadromani committed Jul 8, 2024
1 parent 8a58936 commit fb95083
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions tests/webservice_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def test_bad_ip_address(self):

def test_no_body_error(self):
self.httpserver.expect_request(
"/geoip/v2.1/country/" + "1.2.3.7"
"/geoip/v2.1/country/1.2.3.7"
).respond_with_data(
"",
status=400,
Expand All @@ -159,7 +159,7 @@ def test_no_body_error(self):
def test_weird_body_error(self):

self.httpserver.expect_request(
"/geoip/v2.1/country/" + "1.2.3.8"
"/geoip/v2.1/country/1.2.3.8"
).respond_with_json(
{"wierd": 42},
status=400,
Expand All @@ -175,7 +175,7 @@ def test_weird_body_error(self):
def test_bad_body_error(self):

self.httpserver.expect_request(
"/geoip/v2.1/country/" + "1.2.3.9"
"/geoip/v2.1/country/1.2.3.9"
).respond_with_data(
"bad body",
status=400,
Expand All @@ -188,7 +188,7 @@ def test_bad_body_error(self):

def test_500_error(self):
self.httpserver.expect_request(
"/geoip/v2.1/country/" + "1.2.3.10"
"/geoip/v2.1/country/1.2.3.10"
).respond_with_data(
"",
status=500,
Expand All @@ -200,7 +200,7 @@ def test_500_error(self):
def test_300_error(self):

self.httpserver.expect_request(
"/geoip/v2.1/country/" + "1.2.3.11"
"/geoip/v2.1/country/1.2.3.11"
).respond_with_data(
"",
status=300,
Expand Down Expand Up @@ -248,7 +248,7 @@ def _test_error(self, status, error_code, error_class):
msg = "Some error message"
body = {"error": msg, "code": error_code}
self.httpserver.expect_request(
"/geoip/v2.1/country/" + "1.2.3.18"
"/geoip/v2.1/country/1.2.3.18"
).respond_with_json(
body,
status=status,
Expand Down Expand Up @@ -279,7 +279,7 @@ def custom_handler(r):
return ""

self.httpserver.expect_request(
"/geoip/v2.1/country/" + "1.2.3.4"
"/geoip/v2.1/country/1.2.3.4"
).respond_with_handler(custom_handler)
try:
self.run_client(self.client.country("1.2.3.4"))
Expand Down Expand Up @@ -319,7 +319,7 @@ def test_city_ok(self):

def test_insights_ok(self):
self.httpserver.expect_request(
"/geoip/v2.1/insights/" + "1.2.3.4"
"/geoip/v2.1/insights/1.2.3.4"
).respond_with_json(
self.insights,
status=200,
Expand Down Expand Up @@ -355,7 +355,7 @@ class TestClient(TestBaseClient):
def setUp(self):
self.client_class = Client
self.client = Client(42, "abcdef123456")
self.client._base_uri = self.httpserver.url_for("/") + "geoip/v2.1"
self.client._base_uri = self.httpserver.url_for("/geoip/v2.1")

def run_client(self, v):
return v
Expand All @@ -366,7 +366,7 @@ def setUp(self):
self._loop = asyncio.new_event_loop()
self.client_class = AsyncClient
self.client = AsyncClient(42, "abcdef123456")
self.client._base_uri = self.httpserver.url_for("/") + "geoip/v2.1"
self.client._base_uri = self.httpserver.url_for("/geoip/v2.1")

def tearDown(self):
self._loop.run_until_complete(self.client.close())
Expand Down

0 comments on commit fb95083

Please sign in to comment.