Skip to content
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

Add missing WAGTAILLOCALIZE_SYNC_LIVE_STATUS_ON_TRANSLATE test #677

Merged
merged 1 commit into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
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