Skip to content

Commit

Permalink
Merge pull request #141 from maxmind/greg/fix-header-test
Browse files Browse the repository at this point in the history
Update tests for new mocket version
  • Loading branch information
shadromani authored Mar 1, 2023
2 parents 5c63c45 + 5545e8f commit b2c4531
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
include_package_data=True,
python_requires=">=3.7",
install_requires=requirements,
tests_require=["mocket>=3.8.9"],
tests_require=["mocket>=3.11.0"],
test_suite="tests",
license=geoip2.__license__,
classifiers=[
Expand Down
12 changes: 7 additions & 5 deletions tests/webservice_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,16 +298,18 @@ def test_request(self):
self.assertEqual(
request.path, "/geoip/v2.1/country/1.2.3.4", "correct URI is used"
)
self.assertEqual(
request.headers["Accept"], "application/json", "correct Accept header"
)

# This is to prevent breakage if header normalization in Mocket
# changes again in the future.
headers = {k.lower(): v for k, v in request.headers.items()}
self.assertEqual(headers["accept"], "application/json", "correct Accept header")
self.assertRegex(
request.headers["User-Agent"],
headers["user-agent"],
"^GeoIP2-Python-Client/",
"Correct User-Agent",
)
self.assertEqual(
request.headers["Authorization"],
headers["authorization"],
"Basic NDI6YWJjZGVmMTIzNDU2",
"correct auth",
)
Expand Down

0 comments on commit b2c4531

Please sign in to comment.