Skip to content

Commit

Permalink
Add test for broken link actions
Browse files Browse the repository at this point in the history
Co-authored-by: David Venhoff <[email protected]>
  • Loading branch information
MizukiTemma and david-venhoff committed Jan 17, 2025
1 parent 1852c62 commit 6624f1d
Show file tree
Hide file tree
Showing 3 changed files with 415 additions and 1 deletion.
14 changes: 13 additions & 1 deletion integreat_cms/cms/fixtures/test_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -2791,6 +2791,18 @@
"ignore": false
}
},
{
"model": "linkcheck.link",
"pk": 39,
"fields": {
"content_type": ["cms", "pagetranslation"],
"object_id": 99,
"field": "content",
"url": 4,
"text": "Unchecked ink",
"ignore": false
}
},
{
"model": "linkcheck.link",
"pk": 40,
Expand Down Expand Up @@ -5588,7 +5600,7 @@
"title": "Test links",
"slug": "test_links",
"status": "PUBLIC",
"content": "<div><p><a href=\"https://integreat.app/augsburg/de/willkommen/\">Internal valid</a></p><p><a href=\"https://integreat.app/fake-region/de/willkommen/\">Internal invalid</a></p><p> </p><p><a class=\"link-external\" href=\"https://tuerantuer.de/\">External valid</a></p><p><a class=\"link-external\" href=\"https://tuerantuer.dx/\">External invalid</a></p></div>",
"content": "<div><p><a href=\"https://integreat.app/augsburg/de/willkommen/\">Internal valid</a></p><p><a href=\"https://integreat.app/fake-region/de/willkommen/\">Internal invalid</a></p><p> </p><p><a class=\"link-external\" href=\"https://tuerantuer.de/\">External valid</a></p><p><a class=\"link-external\" href=\"https://tuerantuer.dx/\">External invalid</a></p><p> </p><p><a href=\"https://integreat.app\">Unchecked link</a></p></div>",
"language": 1,
"currently_in_translation": false,
"machine_translated": false,
Expand Down
3 changes: 3 additions & 0 deletions integreat_cms/cms/views/linkcheck/link_replace_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@

from django.contrib import messages
from django.shortcuts import redirect, render
from django.utils.decorators import method_decorator
from django.utils.translation import gettext_lazy as _
from django.views.generic.base import TemplateView

from ...decorators import permission_required
from ...forms import LinkReplaceForm

if TYPE_CHECKING:
Expand All @@ -15,6 +17,7 @@
from django.http import HttpRequest, HttpResponse


@method_decorator(permission_required("cms.view_broken_links"), name="dispatch")
class LinkReplaceView(TemplateView):
"""
View for link replace form
Expand Down
Loading

0 comments on commit 6624f1d

Please sign in to comment.