Skip to content

Commit

Permalink
Expand test coverage to include serve_preview for our base page model
Browse files Browse the repository at this point in the history
  • Loading branch information
stevejalim committed Apr 29, 2024
1 parent 56cb3a4 commit a2b030a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions bedrock/cms/tests/test_rendering.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,8 @@ def test_locale_redirect_will_work_for_cms_pages__default_locale_not_available(
assert redirect_to_best_locale_spy.call_count == 1


def test_locales_are_drawn_from_page_translations(
minimal_site,
rf,
):
@pytest.mark.parametrize("serving_method", ("serve", "serve_preview"))
def test_locales_are_drawn_from_page_translations(minimal_site, rf, serving_method):
assert Locale.objects.count() == 2 # en-US and fr
fr_locale = Locale.objects.get(language_code="fr")

Expand All @@ -107,7 +105,7 @@ def test_locales_are_drawn_from_page_translations(
assert _relative_url == "/en-US/test-page/"
request = rf.get(_relative_url)

resp = page.serve(request)
resp = getattr(page, serving_method)(request)
page_content = str(resp.content)
assert "Test Page" in page_content
assert '<option lang="en-US" value="en-US" selected>English</option>' in page_content
Expand Down

0 comments on commit a2b030a

Please sign in to comment.