Catch the new error raised by redis when it can't find the broker and stub out the call for testing

This commit is contained in:
Trenton H committed 2022-10-10 14:21:42 -07:00
1 parent 5aeb656a48
commit 8025df5fe3
2 files changed
+9 -8

No files matched your search

+6 -3
View File
@@ -397,7 +397,8 @@ class TestBarcode(DirectoriesMixin, TestCase):
dst = os.path.join(settings.SCRATCH_DIR, "patch-code-t-middle.pdf")
shutil.copy(test_file, dst)
self.assertEqual(tasks.consume_file(dst), "File successfully split")
with mock.patch("documents.tasks.async_to_sync"):
self.assertEqual(tasks.consume_file(dst), "File successfully split")
@override_settings(
CONSUMER_ENABLE_BARCODES=True,
@@ -411,7 +412,8 @@ class TestBarcode(DirectoriesMixin, TestCase):
dst = os.path.join(settings.SCRATCH_DIR, "patch-code-t-middle.tiff")
shutil.copy(test_file, dst)
self.assertEqual(tasks.consume_file(dst), "File successfully split")
with mock.patch("documents.tasks.async_to_sync"):
self.assertEqual(tasks.consume_file(dst), "File successfully split")
@override_settings(
CONSUMER_ENABLE_BARCODES=True,
@@ -465,4 +467,5 @@ class TestBarcode(DirectoriesMixin, TestCase):
dst = os.path.join(settings.SCRATCH_DIR, "patch-code-t-middle")
shutil.copy(test_file, dst)
self.assertEqual(tasks.consume_file(dst), "File successfully split")
with mock.patch("documents.tasks.async_to_sync"):
self.assertEqual(tasks.consume_file(dst), "File successfully split")