More test fixing for coverage

This commit is contained in:
Trenton H 2024-02-01 19:22:07 -08:00
parent 9eae84e2d2
commit d4ee469b01
2 changed files with 6 additions and 2 deletions

View File

@ -1303,7 +1303,10 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
classifier_checksum = b"thisisachecksum" classifier_checksum = b"thisisachecksum"
mocked_load.return_value = mock.Mock(last_auto_type_hash=classifier_checksum) mocked_load.side_effect = [
mock.Mock(last_auto_type_hash=classifier_checksum),
mock.Mock(last_auto_type_hash=classifier_checksum),
]
last_modified = timezone.now() last_modified = timezone.now()
cache.set(CLASSIFIER_MODIFIED_KEY, last_modified, CACHE_50_MINUTES) cache.set(CLASSIFIER_MODIFIED_KEY, last_modified, CACHE_50_MINUTES)
@ -1351,6 +1354,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
response = self.client.get(f"/api/documents/{doc.pk}/suggestions/") response = self.client.get(f"/api/documents/{doc.pk}/suggestions/")
self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertFalse(True)
@mock.patch("documents.parsers.parse_date_generator") @mock.patch("documents.parsers.parse_date_generator")
@override_settings(NUMBER_OF_SUGGESTED_DATES=0) @override_settings(NUMBER_OF_SUGGESTED_DATES=0)

View File

@ -525,7 +525,7 @@ class DocumentViewSet(
if classifier is not None: if classifier is not None:
cache.set( cache.set(
doc_key, doc_key,
(classifier.last_auto_type_hash.decode(), resp_data), (classifier.last_auto_type_hash, resp_data),
CACHE_5_MINUTES, CACHE_5_MINUTES,
) )