Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Updates the latest test to use status codes

Trenton H8df1324afdbc
diff --git a/src/documents/tests/test_api.py b/src/documents/tests/test_api.py
index aa6721848..5ad1252e4 100644
--- a/src/documents/tests/test_api.py
+++ b/src/documents/tests/test_api.py
@@ -1331,7 +1331,7 @@ class TestDocumentApi(DirectoriesMixin, APITestCase):
{"document": f, "archive_serial_number": 500},
)
- self.assertEqual(response.status_code, 200)
+ self.assertEqual(response.status_code, status.HTTP_200_OK)
m.assert_called_once()
diff --git a/src/documents/tests/utils.py b/src/documents/tests/utils.py
index 59e21c774..9362d378b 100644
--- a/src/documents/tests/utils.py
+++ b/src/documents/tests/utils.py
@@ -92,20 +92,16 @@ class DirectoriesMixin:
class FileSystemAssertsMixin:
def assertIsFile(self, path: Union[PathLike, str]):
- if not Path(path).resolve().is_file():
- raise AssertionError(f"File does not exist: {path}")
+ self.assertTrue(Path(path).resolve().is_file(), f"File does not exist: {path}")
def assertIsNotFile(self, path: Union[PathLike, str]):
- if Path(path).resolve().is_file():
- raise AssertionError(f"File does exist: {path}")
+ self.assertFalse(Path(path).resolve().is_file(), f"File does exist: {path}")
def assertIsDir(self, path: Union[PathLike, str]):
- if not Path(path).resolve().is_dir():
- raise AssertionError(f"Dir does not exist: {path}")
+ self.assertTrue(Path(path).resolve().is_dir(), f"Dir does not exist: {path}")
def assertIsNotDir(self, path: Union[PathLike, str]):
- if Path(path).resolve().is_dir():
- raise AssertionError(f"Dir does exist: {path}")
+ self.assertFalse(Path(path).resolve().is_dir(), f"Dir does exist: {path}")
class ConsumerProgressMixin: