mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-05-21 12:52:13 -05:00
Fix classifier test, use Path
This commit is contained in:
parent
02386d6513
commit
4993bcf6ab
@ -233,7 +233,11 @@ class TestSystemStatus(APITestCase):
|
||||
self.assertEqual(response.data["tasks"]["classifier_status"], "WARNING")
|
||||
self.assertIsNotNone(response.data["tasks"]["classifier_error"])
|
||||
|
||||
def test_system_status_classifier_error(self):
|
||||
@mock.patch(
|
||||
"documents.classifier.load_classifier",
|
||||
side_effect=ClassifierModelCorruptError(),
|
||||
)
|
||||
def test_system_status_classifier_error(self, mock_load_classifier):
|
||||
"""
|
||||
GIVEN:
|
||||
- The classifier does exist but is corrupt
|
||||
@ -250,8 +254,6 @@ class TestSystemStatus(APITestCase):
|
||||
) as does_exist,
|
||||
override_settings(MODEL_FILE=Path(does_exist.name)),
|
||||
):
|
||||
with mock.patch("documents.classifier.load_classifier") as mock_load:
|
||||
mock_load.side_effect = ClassifierModelCorruptError()
|
||||
Document.objects.create(
|
||||
title="Test Document",
|
||||
)
|
||||
|
@ -2159,7 +2159,7 @@ class SystemStatusView(PassUserMixin):
|
||||
matching_algorithm=Tag.MATCH_AUTO,
|
||||
).exists()
|
||||
)
|
||||
and not os.path.isfile(settings.MODEL_FILE)
|
||||
and not settings.MODEL_FILE.exists()
|
||||
):
|
||||
# if classifier file doesn't exist just classify as a warning
|
||||
classifier_error = "Classifier file does not exist (yet). Re-training may be pending."
|
||||
|
Loading…
x
Reference in New Issue
Block a user