Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MizukiTemma committed Nov 20, 2024
1 parent 70a5d51 commit fbda721
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion integreat_cms/cms/views/linkcheck/linkcheck_list_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def post(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse:
messages.success(request, _("Links were successfully checked"))
# Add short delay to allow rechecking to be finished when page reloads
time.sleep(1)

invalidate_model(Link)
invalidate_model(Url)

Expand Down
34 changes: 17 additions & 17 deletions tests/cms/views/link_replace/test_link_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
# Parameters for test
# (
# <network management or region>,
# <number of links with url=SEARCH_REPLACE_TARGET_URL before successful search&replace>,
# <number of links with url=SEARCH_REPLACE_TARGET_URL which must stay unchanged after successful search&replace>
# <number of links with url=OLD_URL before successful search&replace>,
# <number of links with url=OLD_URL after successful search&replace>
# )
url_replace_parameters = [("network_management", 4, 0), ("augsburg", 4, 1)]

Expand Down Expand Up @@ -61,15 +61,15 @@ def test_url_replace(
"url_id": url_object.id,
}
if not region == "network_management":
slugs.update(
kwargs.update(
{
"region_slug": region,
}
)

action_url = reverse(
"edit_url",
kwargs=slugs,
kwargs=kwargs,
)
with enable_listeners():
response = client.post(
Expand All @@ -94,7 +94,7 @@ def test_url_replace(
)

assert Link.objects.filter(url__url=OLD_URL).count() == after
# assert Link.objects.filter(url__url=NEW_URL).count() == before - after
assert Link.objects.filter(url__url=NEW_URL).count() == before - after

elif role == ANONYMOUS:
assert response.status_code == 302
Expand Down Expand Up @@ -152,15 +152,15 @@ def test_search_and_replace_links(

kwargs = {}
if not region == "network_management":
slugs.update(
kwargs.update(
{
"region_slug": region,
}
)

action_url = reverse(
"search_and_replace_link",
kwargs=slugs,
kwargs=kwargs,
)

with enable_listeners():
Expand Down Expand Up @@ -188,10 +188,10 @@ def test_search_and_replace_links(
)

assert Link.objects.filter(url__url=SEARCH_REPLACE_TARGET_URL).count() == after
# assert (
# Link.objects.filter(url__url=TARGET_URL_AFTER_REPLACE).count()
# == before - after
# )
assert (
Link.objects.filter(url__url=TARGET_URL_AFTER_REPLACE).count()
== before - after
)

elif role == ANONYMOUS:
assert response.status_code == 302
Expand Down Expand Up @@ -260,17 +260,17 @@ def test_bulk_ignore_unignore_links(
assert target_links.filter(ignore=True).count() == before[0]
assert target_links.filter(ignore=False).count() == before[1]

slugs = {"url_filter": "valid"}
kwargs = {"url_filter": "valid"}
if not region == "network_management":
slugs.update(
kwargs.update(
{
"region_slug": region,
}
)

action_url = reverse(
"linkcheck",
kwargs=slugs,
kwargs=kwargs,
)
response = client.post(
action_url,
Expand Down Expand Up @@ -351,17 +351,17 @@ def test_bulk_recheck_links(
unchecked_url, _ = filter_urls(region_slug, "unchecked")
assert len(unchecked_url) == 1

slugs = {"url_filter": "unchecked"}
kwargs = {"url_filter": "unchecked"}
if not region == "network_management":
slugs.update(
kwargs.update(
{
"region_slug": region,
}
)

action_url = reverse(
"linkcheck",
kwargs=slugs,
kwargs=kwargs,
)
response = client.post(
action_url,
Expand Down

0 comments on commit fbda721

Please sign in to comment.