Skip to content

Commit

Permalink
reverse_passthru_lazy coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiask committed Feb 12, 2024
1 parent 8f32b3b commit 361eb7b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/testapp/test_passthru.py
Expand Up @@ -4,7 +4,7 @@
from django.urls import NoReverseMatch, set_urlconf

from feincms3.applications import apps_urlconf
from feincms3.root.passthru import reverse_passthru
from feincms3.root.passthru import reverse_passthru, reverse_passthru_lazy
from testapp.models import Page


Expand Down Expand Up @@ -53,6 +53,8 @@ def test_passthru_render(self):

def test_reverse_passthru(self):
"""Try reversing passthru views"""
lazy = reverse_passthru_lazy("imprint")

Page.objects.create(
title="Impressum",
slug="impressum",
Expand All @@ -65,9 +67,12 @@ def test_reverse_passthru(self):

with self.assertRaises(NoReverseMatch):
reverse_passthru("imprint")
with self.assertRaises(NoReverseMatch):
str(lazy)
with override_urlconf(apps_urlconf()):
url = reverse_passthru("imprint")
self.assertEqual(url, "/de/impressum/")
self.assertEqual(str(lazy), "/de/impressum/")

# The fallback keyword argument is supported
self.assertEqual(reverse_passthru("imprint", fallback="/asdf/"), "/asdf/")
Expand Down

0 comments on commit 361eb7b

Please sign in to comment.