Fixes that broken test

This commit is contained in:
Trenton H 2024-02-01 19:06:08 -08:00
parent ec3126be9c
commit 9eae84e2d2

View File

@ -1301,9 +1301,13 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
settings.MODEL_FILE.touch()
classifier_checksum = b"thisisachecksum"
mocked_load.return_value = mock.Mock(last_auto_type_hash=classifier_checksum)
last_modified = timezone.now()
cache.set(CLASSIFIER_MODIFIED_KEY, last_modified, CACHE_50_MINUTES)
cache.set(CLASSIFIER_HASH_KEY, "thisisachecksum", CACHE_50_MINUTES)
cache.set(CLASSIFIER_HASH_KEY, classifier_checksum, CACHE_50_MINUTES)
cache.set(
CLASSIFIER_VERSION_KEY,
DocumentClassifier.FORMAT_VERSION,
@ -1342,7 +1346,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
self.assertIn("ETag", response.headers)
self.assertEqual(
response.headers["ETag"],
f'"thisisachecksum:{settings.NUMBER_OF_SUGGESTED_DATES}"',
f'"{classifier_checksum}:{settings.NUMBER_OF_SUGGESTED_DATES}"',
)
response = self.client.get(f"/api/documents/{doc.pk}/suggestions/")