Also handles confirming returned predictions are still automatic matching, in case the classifier hasn't been run since a type was changed

This commit is contained in:
Trenton H
2023-07-24 10:19:47 -07:00
parent 26d5730ad2
commit 802e5591ce
2 changed files with 30 additions and 8 deletions

View File

@@ -561,10 +561,16 @@ class TestConsumer(DirectoriesMixin, FileSystemAssertsMixin, TestCase):
@mock.patch("documents.consumer.load_classifier")
def testClassifyDocument(self, m):
correspondent = Correspondent.objects.create(name="test")
dtype = DocumentType.objects.create(name="test")
t1 = Tag.objects.create(name="t1")
t2 = Tag.objects.create(name="t2")
correspondent = Correspondent.objects.create(
name="test",
matching_algorithm=Correspondent.MATCH_AUTO,
)
dtype = DocumentType.objects.create(
name="test",
matching_algorithm=DocumentType.MATCH_AUTO,
)
t1 = Tag.objects.create(name="t1", matching_algorithm=Tag.MATCH_AUTO)
t2 = Tag.objects.create(name="t2", matching_algorithm=Tag.MATCH_AUTO)
m.return_value = MagicMock()
m.return_value.predict_correspondent.return_value = correspondent.pk