-
Notifications
You must be signed in to change notification settings - Fork 926
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wagtail/Smartling robustness improvements (#15699)
* Fix docs to provide better example of how to download CMS media * Upgrade to 0.2.0 release of our fork of wagtaildraftsharing * Update our visual context callback to be more robust. Ensure the visual context sent to Smartling is always with a fresh sharing link with no expiry By default, these now last 28 days, which might be enough, but we don't want to take the risk, given how fiddly the cleanup is of an expired link causing initial sync to fail * Ensure our wrapper for the sync_smartling management command logs to Sentry It already has SENTRY_DSN available to it * Add more Sentry logging to our visual context callback And also make it more robust - preferring to get strings to Smartling without a visual context, rather than fail altogether * Add comment about settings name to avoid wasted checking time * Upgrade to wagtail-localize-smartling 0.8 with async batch upload This will get us around the File Locked issue we saw in prod * Expand test coverage
- Loading branch information
1 parent
88129ee
commit 99c0ca2
Showing
9 changed files
with
121 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
|
||
from django.contrib.auth.models import User | ||
from django.core.management import call_command | ||
from django.test import TransactionTestCase | ||
from django.test import TestCase, TransactionTestCase | ||
|
||
import everett | ||
|
||
|
@@ -175,3 +175,24 @@ def test_multiple_emails_available_but_exist_already_somehow(self, mock_write): | |
call("User [email protected] already exists - not creating\n"), | ||
], | ||
) | ||
|
||
|
||
class SmartlingSyncTests(TestCase): | ||
@patch("bedrock.cms.management.commands.run_smartling_sync.call_command") | ||
def test_sentry_logging_for_run_smartling_sync_command(self, mock_call_command): | ||
test_exception = Exception("Boom!") | ||
mock_call_command.side_effect = test_exception | ||
with patch("bedrock.cms.management.commands.run_smartling_sync.capture_exception") as mock_capture_exception: | ||
call_command("run_smartling_sync") | ||
mock_capture_exception.assert_called_once_with(test_exception) | ||
|
||
@patch("bedrock.cms.management.commands.bootstrap_local_admin.sys.stderr.write") | ||
@patch("bedrock.cms.management.commands.run_smartling_sync.call_command") | ||
def test_error_messaging_for_run_smartling_sync_command(self, mock_call_command, mock_stderr_write): | ||
test_exception = Exception("Boom!") | ||
mock_call_command.side_effect = test_exception | ||
call_command("run_smartling_sync") | ||
|
||
expected_output = "\nsync_smartling did not execute successfully: Boom!\n" | ||
output = mock_stderr_write.call_args_list[0][0][0] | ||
self.assertEqual(output, expected_output) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters