Skip to content

Commit

Permalink
fix edit url got redirect issue for test_utils.
Browse files Browse the repository at this point in the history
  • Loading branch information
FreemanPancake committed Oct 29, 2024
1 parent df7eeb2 commit 246b580
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
UNPUBLISHED,
)

from djangocms_navigation.compat import CMS_41

Check failure on line 18 in tests/test_utils.py

View workflow job for this annotation

GitHub Actions / flake8

'djangocms_navigation.compat.CMS_41' imported but unused
from djangocms_navigation.models import MenuContent
from djangocms_navigation.test_utils import factories
from djangocms_navigation.test_utils.app_1.models import TestModel1, TestModel2
Expand Down Expand Up @@ -108,6 +109,12 @@ def setUp(self):
version__state=PUBLISHED,
)

# for draft version get edit url.
self.page_content_draft = factories.PageContentWithVersionFactory(
version__created_by=self.get_superuser(),
version__state=DRAFT,
)

def test_live_endpoint(self):
live_endpoint = self.page_content.get_absolute_url(language=self.page_content.language)

Expand All @@ -128,7 +135,7 @@ def test_preview_endpoint(self):
self.assertTrue(actual)

def test_edit_endpoint(self):
edit_endpoint = get_object_edit_url(self.page_content, language=self.page_content.language)
edit_endpoint = get_object_edit_url(self.page_content_draft, language=self.page_content.language)

with self.login_user_context(self.get_superuser()):
response = self.client.get(edit_endpoint)
Expand Down

0 comments on commit 246b580

Please sign in to comment.