]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Updates the latest test to use status codes
authorTrenton H <797416+stumpylog@users.noreply.github.com>
Mon, 20 Feb 2023 16:36:22 +0000 (08:36 -0800)
committerTrenton H <797416+stumpylog@users.noreply.github.com>
Mon, 20 Feb 2023 18:25:21 +0000 (10:25 -0800)
src/documents/tests/test_api.py
src/documents/tests/utils.py

index aa672184883b6edeeb009b7e97c662f2003b3926..5ad1252e4d35809a48c939946e25043d134ba6bb 100644 (file)
@@ -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()
 
index 59e21c774203b2985eef794372ef46fe7199deeb..9362d378bf3eeb3b108c98b90c77e8687d5c3b1d 100644 (file)
@@ -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: