Skip to content

Commit

Permalink
Fix mock paths in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ababic authored and gasman committed Jun 4, 2024
1 parent 30cb881 commit c7caa45
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion wagtail/api/v2/tests/test_documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ def test_find_by_id_nonexistent(self):
},
WAGTAILAPI_BASE_URL="http://api.example.com",
)
@mock.patch("wagtail.contrib.frontend_cache.backends.HTTPBackend.purge")
@mock.patch("wagtail.contrib.frontend_cache.backends.http.HTTPBackend.purge")
class TestDocumentCacheInvalidation(TestCase):
fixtures = ["demosite.json"]

Expand Down
2 changes: 1 addition & 1 deletion wagtail/api/v2/tests/test_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ def test_find_by_id_nonexistent(self):
},
WAGTAILAPI_BASE_URL="http://api.example.com",
)
@mock.patch("wagtail.contrib.frontend_cache.backends.HTTPBackend.purge")
@mock.patch("wagtail.contrib.frontend_cache.backends.http.HTTPBackend.purge")
class TestImageCacheInvalidation(TestCase):
fixtures = ["demosite.json"]

Expand Down
2 changes: 1 addition & 1 deletion wagtail/api/v2/tests/test_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -1848,7 +1848,7 @@ def test_image_block_with_custom_get_api_representation(self):
},
WAGTAILAPI_BASE_URL="http://api.example.com",
)
@mock.patch("wagtail.contrib.frontend_cache.backends.HTTPBackend.purge")
@mock.patch("wagtail.contrib.frontend_cache.backends.http.HTTPBackend.purge")
class TestPageCacheInvalidation(TestCase):
fixtures = ["demosite.json"]

Expand Down
10 changes: 5 additions & 5 deletions wagtail/contrib/frontend_cache/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def test_azure_front_door_get_client(self):
self.assertIs(client._config.credential, mock_credentials)

@mock.patch(
"wagtail.contrib.frontend_cache.backends.AzureCdnBackend._make_purge_call"
"wagtail.contrib.frontend_cache.backends.azure.AzureCdnBackend._make_purge_call"
)
def test_azure_cdn_purge(self, make_purge_call_mock):
backends = get_backends(
Expand Down Expand Up @@ -215,7 +215,7 @@ def test_azure_cdn_purge(self, make_purge_call_mock):
self.assertEqual(call_args[1], ["/home/events/christmas/?test=1", "/blog/"])

@mock.patch(
"wagtail.contrib.frontend_cache.backends.AzureFrontDoorBackend._make_purge_call"
"wagtail.contrib.frontend_cache.backends.azure.AzureFrontDoorBackend._make_purge_call"
)
def test_azure_front_door_purge(self, make_purge_call_mock):
backends = get_backends(
Expand Down Expand Up @@ -286,7 +286,7 @@ def test_http_urlerror(self):
log_output.output[0],
)

@mock.patch("wagtail.contrib.frontend_cache.backends.urlopen")
@mock.patch("wagtail.contrib.frontend_cache.backends.http.urlopen")
def _test_http_with_side_effect(self, urlopen_mock, urlopen_side_effect):
# given a backends configuration with one HTTP backend
backends = get_backends(
Expand Down Expand Up @@ -324,7 +324,7 @@ def test_cloudfront_validate_distribution_id(self):
)

@mock.patch(
"wagtail.contrib.frontend_cache.backends.CloudfrontBackend._create_invalidation"
"wagtail.contrib.frontend_cache.backends.cloudfront.CloudfrontBackend._create_invalidation"
)
def test_cloudfront_distribution_id_mapping(self, _create_invalidation):
backends = get_backends(
Expand Down Expand Up @@ -668,7 +668,7 @@ def test_multiple_calls(self):
],
)

@mock.patch("wagtail.contrib.frontend_cache.backends.requests.delete")
@mock.patch("wagtail.contrib.frontend_cache.backends.cloudflare.requests.delete")
def test_http_error_on_cloudflare_purge_batch(self, requests_delete_mock):
backend_settings = {
"cloudflare": {
Expand Down

0 comments on commit c7caa45

Please sign in to comment.