10000 fix: added redirect message when in editing a redirect toolbar object by theShinigami · Pull Request #8056 · django-cms/django-cms · GitHub
[go: up one dir, main page]

Skip to content

fix: added redirect message when in editing a redirect toolbar object #8056

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

Merged
merged 4 commits into from
Nov 3, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
test: add test to verify message display when redirect is set
  • Loading branch information
theShinigami committed Nov 2, 2024
commit 5216c174b81274dac944556600865cdff81d849f
22 changes: 22 additions & 0 deletions cms/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,28 @@ def test_apphook_not_hooked(self):
self.assertEqual(response.status_code, 200)
self.apphook_clear()

def test_redirect_preview_in_edit_mode(self):

user = self.get_superuser()
page = create_page("page", "nav_playground.html", "fr")
page_content = create_page_content("en", "home", page, redirect="https://example.com")

page.set_as_homepage()

with self.login_user_context(user), force_language('fr'):
edit_url = get_object_edit_url(page_content, language='fr')
response = self.client.get(edit_url, follow=True)

expected = f"""
<div class="cms-screenblock">
<div class="cms-screenblock-inner">
<h1>This page has no preview!</h1>
<p>It is being redirected to: <a href="{page_content.redirect}">{page_content.redirect}</a></p>
</div>
</div>
"""
self.assertContains(response, expected, count=1, html=True)

def test_external_redirect(self):
# test external redirect
redirect_one = 'https://www.django-cms.org/'
Expand Down
Loading
0