Skip to content

Commit

Permalink
Add missing WAGTAILLOCALIZE_SYNC_LIVE_STATUS_ON_TRANSLATE test (#677)
Browse files Browse the repository at this point in the history
Co-authored-by: Matthew Linares <[email protected]>
  • Loading branch information
zerolab and mattlinares authored Feb 22, 2023
1 parent 5471597 commit b0f5fb4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/how-to/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class MyPage(Page):
## Disabling default publication of translated pages

Live pages that are submitted for translation are made live immediately. If you wish live pages submitted for
translatio to remain as drafts, set `WAGTAILLOCALIZE_SYNC_LIVE_STATUS_ON_TRANSLATE = False` in your settings file.
translation to remain as drafts, set `WAGTAILLOCALIZE_SYNC_LIVE_STATUS_ON_TRANSLATE = False` in your settings file.

## Control translation cleanup mode

Expand Down
19 changes: 19 additions & 0 deletions wagtail_localize/tests/test_submit_translations.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,25 @@ def test_post_submit_page_translation(self):
response, reverse("wagtailadmin_pages:edit", args=[translated_page.id])
)

@override_settings(WAGTAILLOCALIZE_SYNC_LIVE_STATUS_ON_TRANSLATE=False)
def test_post_submit_page_translation_draft(self):
self.client.post(
reverse(
"wagtail_localize:submit_page_translation",
args=[self.en_blog_index.id],
),
{"locales": [self.fr_locale.id]},
)

translation = Translation.objects.get()
self.assertEqual(translation.source.locale, self.en_locale)
self.assertEqual(translation.target_locale, self.fr_locale)
self.assertTrue(translation.created_at)

# The translated page should've been created and published
translated_page = self.en_blog_index.get_translation(self.fr_locale)
self.assertFalse(translated_page.live)

def test_post_submit_page_translation_submits_linked_snippets(self):
self.en_blog_index.test_snippet = TestSnippet.objects.create(
field="My test snippet"
Expand Down

0 comments on commit b0f5fb4

Please sign in to comment.