Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use assertEqual instead of assertEquals for Python 3.11 compatibility. #45

Merged
merged 1 commit into from
Nov 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion wiremock/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def assertDictContainsKey(self, obj, key):

def assertDictContainsKeyWithValue(self, obj, key, value):
if key in obj:
self.assertEquals(value, obj[key])
self.assertEqual(value, obj[key])
else:
raise AssertionError("{} is not in dict: {}".format(key, obj))

Expand Down
24 changes: 12 additions & 12 deletions wiremock/tests/resource_tests/mappings_tests/resource_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ def test_create_mapping(self):

r = Mappings.create_mapping(m)
self.assertIsInstance(r, MappingResponse)
self.assertEquals(200, r.status)
self.assertEquals("test", r.body)
self.assertEqual(200, r.status)
self.assertEqual("test", r.body)

@attr("unit", "mappings", "resource")
@responses.activate
Expand All @@ -29,7 +29,7 @@ def test_retrieve_all_mappings(self):
r = Mappings.retrieve_all_mappings()
self.assertIsInstance(r, AllMappings)
self.assertIsInstance(r.meta, MappingMeta)
self.assertEquals(1, r.meta.total)
self.assertEqual(1, r.meta.total)

@attr("unit", "mappings", "resource")
@responses.activate
Expand All @@ -40,8 +40,8 @@ def test_retrieve_mapping(self):

r = Mappings.retrieve_mapping(e)
self.assertIsInstance(r, Mapping)
self.assertEquals("1234-5678", r.id)
self.assertEquals(1, r.priority)
self.assertEqual("1234-5678", r.id)
self.assertEqual(1, r.priority)

@attr("unit", "mappings", "resource")
@responses.activate
Expand All @@ -52,32 +52,32 @@ def test_update_mapping(self):

r = Mappings.update_mapping(e)
self.assertIsInstance(r, Mapping)
self.assertEquals("1234-5678", r.id)
self.assertEquals(1, r.priority)
self.assertEqual("1234-5678", r.id)
self.assertEqual(1, r.priority)

@attr("unit", "mappings", "resource")
@responses.activate
def test_persist_mappings(self):
responses.add(responses.POST, "http://localhost/__admin/mappings/save", body="", status=200)

r = Mappings.persist_mappings()
self.assertEquals(200, r.status_code)
self.assertEqual(200, r.status_code)

@attr("unit", "mappings", "resource")
@responses.activate
def test_reset_mappings(self):
responses.add(responses.POST, "http://localhost/__admin/mappings/reset", body="", status=200)

r = Mappings.reset_mappings()
self.assertEquals(200, r.status_code)
self.assertEqual(200, r.status_code)

@attr("unit", "mappings", "resource")
@responses.activate
def test_delete_all_mappings(self):
responses.add(responses.DELETE, "http://localhost/__admin/mappings", body="", status=200)

r = Mappings.delete_all_mappings()
self.assertEquals(200, r.status_code)
self.assertEqual(200, r.status_code)

@attr("unit", "mappings", "resource")
@responses.activate
Expand All @@ -86,7 +86,7 @@ def test_delete_mapping(self):
responses.add(responses.DELETE, "http://localhost/__admin/mappings/1234-5678", body="", status=200)

r = Mappings.delete_mapping(e)
self.assertEquals(200, r.status_code)
self.assertEqual(200, r.status_code)

@attr("unit", "mappings", "resource")
@responses.activate
Expand All @@ -100,4 +100,4 @@ def test_delete_mapping_by_metadata(self):
}
})

self.assertEquals(200, r.status_code)
self.assertEqual(200, r.status_code)
94 changes: 47 additions & 47 deletions wiremock/tests/resource_tests/mappings_tests/serialization_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ def test_basic_auth_credentials_deserialization(self):
serialized = {"username": "username", "password": "password"}
e = BasicAuthCredentials.from_dict(serialized)
self.assertIsInstance(e, BasicAuthCredentials)
self.assertEquals("username", e.username)
self.assertEquals("password", e.password)
self.assertEqual("username", e.username)
self.assertEqual("password", e.password)

@attr("unit", "serialization", "mappings")
def test_mapping_meta_serialization(self):
Expand All @@ -38,7 +38,7 @@ def test_mapping_meta_deserialization(self):
serialized = {"total": 1}
e = MappingMeta.from_dict(serialized)
self.assertIsInstance(e, MappingMeta)
self.assertEquals(1, e.total)
self.assertEqual(1, e.total)

@attr("unit", "serialization", "mappings")
def test_delay_distribution_serialization(self):
Expand All @@ -55,11 +55,11 @@ def test_delay_distribution_deserialization(self):
serialized = {"type": "lognormal", "median": 0.1, "sigma": 0.2, "lower": 3, "upper": 4}
e = DelayDistribution.from_dict(serialized)
self.assertIsInstance(e, DelayDistribution)
self.assertEquals("lognormal", e.distribution_type)
self.assertEquals(0.1, e.median)
self.assertEquals(0.2, e.sigma)
self.assertEquals(3, e.lower)
self.assertEquals(4, e.upper)
self.assertEqual("lognormal", e.distribution_type)
self.assertEqual(0.1, e.median)
self.assertEqual(0.2, e.sigma)
self.assertEqual(3, e.lower)
self.assertEqual(4, e.upper)

@attr("unit", "serialization", "mappings")
def test_mapping_request_serialization(self):
Expand Down Expand Up @@ -106,19 +106,19 @@ def test_mapping_request_deserialization(self):
}
e = MappingRequest.from_dict(serialized)
self.assertIsInstance(e, MappingRequest)
self.assertEquals("GET", e.method)
self.assertEquals("test1", e.url)
self.assertEquals("test2", e.url_path)
self.assertEquals("test3", e.url_path_pattern)
self.assertEquals("test4", e.url_pattern)
self.assertEqual("GET", e.method)
self.assertEqual("test1", e.url)
self.assertEqual("test2", e.url_path)
self.assertEqual("test3", e.url_path_pattern)
self.assertEqual("test4", e.url_pattern)
self.assertIsInstance(e.basic_auth_credentials, BasicAuthCredentials)
self.assertEquals("username", e.basic_auth_credentials.username)
self.assertEquals("password", e.basic_auth_credentials.password)
self.assertEquals({"chocolate": "chip"}, e.cookies)
self.assertEquals({"Accept": "stuff"}, e.headers)
self.assertEquals({"param": "1"}, e.query_parameters)
self.assertEquals({"test": "test2"}, e.body_patterns)
self.assertEquals({"key": [1, 2, 3]}, e.metadata)
self.assertEqual("username", e.basic_auth_credentials.username)
self.assertEqual("password", e.basic_auth_credentials.password)
self.assertEqual({"chocolate": "chip"}, e.cookies)
self.assertEqual({"Accept": "stuff"}, e.headers)
self.assertEqual({"param": "1"}, e.query_parameters)
self.assertEqual({"test": "test2"}, e.body_patterns)
self.assertEqual({"key": [1, 2, 3]}, e.metadata)

@attr("unit", "serialization", "mappings")
def test_mapping_response_serialization(self):
Expand Down Expand Up @@ -177,22 +177,22 @@ def test_mapping_response_deserialization(self):
}
e = MappingResponse.from_dict(serialized)
self.assertIsInstance(e, MappingResponse)
self.assertEquals({"test": "1"}, e.additional_proxy_request_headers)
self.assertEquals("test2", e.base64_body)
self.assertEquals("test3", e.body)
self.assertEquals("test4", e.body_file_name)
self.assertEquals("test5", e.json_body)
self.assertEqual({"test": "1"}, e.additional_proxy_request_headers)
self.assertEqual("test2", e.base64_body)
self.assertEqual("test3", e.body)
self.assertEqual("test4", e.body_file_name)
self.assertEqual("test5", e.json_body)
self.assertIsInstance(e.delay_distribution, DelayDistribution)
self.assertEquals("lognormal", e.delay_distribution.distribution_type)
self.assertEquals("test6", e.fault)
self.assertEquals(500, e.fixed_delay_milliseconds)
self.assertEquals("test7", e.from_configured_stub)
self.assertEquals({"test": "1"}, e.headers)
self.assertEquals("test8", e.proxy_base_url)
self.assertEquals(200, e.status)
self.assertEquals("test9", e.status_message)
self.assertEquals({"test2": "2"}, e.transformer_parameters)
self.assertEquals(["test10"], e.transformers)
self.assertEqual("lognormal", e.delay_distribution.distribution_type)
self.assertEqual("test6", e.fault)
self.assertEqual(500, e.fixed_delay_milliseconds)
self.assertEqual("test7", e.from_configured_stub)
self.assertEqual({"test": "1"}, e.headers)
self.assertEqual("test8", e.proxy_base_url)
self.assertEqual(200, e.status)
self.assertEqual("test9", e.status_message)
self.assertEqual({"test2": "2"}, e.transformer_parameters)
self.assertEqual(["test10"], e.transformers)

@attr("unit", "serialization", "mappings")
def test_mapping_serialization(self):
Expand Down Expand Up @@ -230,18 +230,18 @@ def test_mapping_deserialization(self):
}
e = Mapping.from_dict(serialized)
self.assertIsInstance(e, Mapping)
self.assertEquals(1, e.priority)
self.assertEqual(1, e.priority)
self.assertIsInstance(e.request, MappingRequest)
self.assertEquals("GET", e.request.method)
self.assertEquals("test", e.request.url)
self.assertEqual("GET", e.request.method)
self.assertEqual("test", e.request.url)
self.assertIsInstance(e.response, MappingResponse)
self.assertEquals(200, e.response.status)
self.assertEquals("test2", e.response.status_message)
self.assertEquals(False, e.persistent)
self.assertEquals({"test": "1"}, e.post_serve_actions)
self.assertEquals("test3", e.new_scenario_state)
self.assertEquals("test4", e.required_scenario_state)
self.assertEquals("test5", e.scenario_name)
self.assertEqual(200, e.response.status)
self.assertEqual("test2", e.response.status_message)
self.assertEqual(False, e.persistent)
self.assertEqual({"test": "1"}, e.post_serve_actions)
self.assertEqual("test3", e.new_scenario_state)
self.assertEqual("test4", e.required_scenario_state)
self.assertEqual("test5", e.scenario_name)

@attr("unit", "serialization", "mappings")
def test_all_mappings_serialization(self):
Expand All @@ -258,6 +258,6 @@ def test_all_mappings_deserialization(self):
self.assertIsInstance(e.mappings, list)
m = e.mappings[0]
self.assertIsInstance(m, Mapping)
self.assertEquals(1, m.priority)
self.assertEqual(1, m.priority)
self.assertIsInstance(e.meta, MappingMeta)
self.assertEquals(1, e.meta.total)
self.assertEqual(1, e.meta.total)
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_find_nearest_misses_by_request(self):
self.assertIsInstance(r.near_misses, list)
result = r.near_misses[0]
self.assertIsInstance(result, NearMissMatch)
self.assertEquals("test", result.request.url)
self.assertEqual("test", result.request.url)

@attr("unit", "nearmisses", "resource")
@responses.activate
Expand All @@ -58,4 +58,4 @@ def test_find_nearest_misses_by_request_pattern(self):
self.assertIsInstance(r.near_misses, list)
result = r.near_misses[0]
self.assertIsInstance(result, NearMissMatch)
self.assertEquals("test", result.request.url)
self.assertEqual("test", result.request.url)
Loading