A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Missed one mock
Trenton Holmes1262c121f07c
diff --git a/src/documents/tests/test_tasks.py b/src/documents/tests/test_tasks.pyindex a2b4ef000..8b104ab1d 100644--- a/src/documents/tests/test_tasks.py+++ b/src/documents/tests/test_tasks.py@@ -11,6 +11,7 @@ from documents.models import DocumentTypefrom documents.models import Tagfrom documents.sanity_checker import SanityCheckFailedExceptionfrom documents.sanity_checker import SanityCheckMessages+from documents.tests.test_classifier import dummy_preprocessfrom documents.tests.utils import DirectoriesMixin@@ -75,21 +76,26 @@ class TestClassifier(DirectoriesMixin, TestCase):doc = Document.objects.create(correspondent=c, content="test", title="test")self.assertFalse(os.path.isfile(settings.MODEL_FILE))- tasks.train_classifier()- self.assertTrue(os.path.isfile(settings.MODEL_FILE))- mtime = os.stat(settings.MODEL_FILE).st_mtime-- tasks.train_classifier()- self.assertTrue(os.path.isfile(settings.MODEL_FILE))- mtime2 = os.stat(settings.MODEL_FILE).st_mtime- self.assertEqual(mtime, mtime2)-- doc.content = "test2"- doc.save()- tasks.train_classifier()- self.assertTrue(os.path.isfile(settings.MODEL_FILE))- mtime3 = os.stat(settings.MODEL_FILE).st_mtime- self.assertNotEqual(mtime2, mtime3)+ with mock.patch(+ "documents.classifier.DocumentClassifier.preprocess_content",+ ) as pre_proc_mock:+ pre_proc_mock.side_effect = dummy_preprocess++ tasks.train_classifier()+ self.assertTrue(os.path.isfile(settings.MODEL_FILE))+ mtime = os.stat(settings.MODEL_FILE).st_mtime++ tasks.train_classifier()+ self.assertTrue(os.path.isfile(settings.MODEL_FILE))+ mtime2 = os.stat(settings.MODEL_FILE).st_mtime+ self.assertEqual(mtime, mtime2)++ doc.content = "test2"+ doc.save()+ tasks.train_classifier()+ self.assertTrue(os.path.isfile(settings.MODEL_FILE))+ mtime3 = os.stat(settings.MODEL_FILE).st_mtime+ self.assertNotEqual(mtime2, mtime3)class TestSanityCheck(DirectoriesMixin, TestCase):