Fix tests

This commit is contained in:
shamoon 2024-11-07 10:32:15 -08:00
parent bc4d3925cc
commit 3a7eee2c2e
No known key found for this signature in database
2 changed files with 6 additions and 3 deletions

View File

@ -35,7 +35,7 @@ def setup_directories():
dirs.scratch_dir = Path(tempfile.mkdtemp())
dirs.media_dir = Path(tempfile.mkdtemp())
dirs.consumption_dir = Path(tempfile.mkdtemp())
dirs.consumption_failed_dir = dirs.consumption_dir / "failed"
dirs.consumption_failed_dir = Path(tempfile.mkdtemp("failed"))
dirs.static_dir = Path(tempfile.mkdtemp())
dirs.index_dir = dirs.data_dir / "index"
dirs.originals_dir = dirs.media_dir / "documents" / "originals"

View File

@ -29,10 +29,11 @@ class TestChecks(DirectoriesMixin, TestCase):
MEDIA_ROOT="uuh",
DATA_DIR="whatever",
CONSUMPTION_DIR="idontcare",
CONSUMPTION_FAILED_DIR="nope",
)
def test_paths_check_dont_exist(self):
msgs = paths_check(None)
self.assertEqual(len(msgs), 3, str(msgs))
self.assertEqual(len(msgs), 4, str(msgs))
for msg in msgs:
self.assertTrue(msg.msg.endswith("is set but doesn't exist."))
@ -41,13 +42,15 @@ class TestChecks(DirectoriesMixin, TestCase):
os.chmod(self.dirs.data_dir, 0o000)
os.chmod(self.dirs.media_dir, 0o000)
os.chmod(self.dirs.consumption_dir, 0o000)
os.chmod(self.dirs.consumption_failed_dir, 0o000)
self.addCleanup(os.chmod, self.dirs.data_dir, 0o777)
self.addCleanup(os.chmod, self.dirs.media_dir, 0o777)
self.addCleanup(os.chmod, self.dirs.consumption_dir, 0o777)
self.addCleanup(os.chmod, self.dirs.consumption_failed_dir, 0o777)
msgs = paths_check(None)
self.assertEqual(len(msgs), 3)
self.assertEqual(len(msgs), 4)
for msg in msgs:
self.assertTrue(msg.msg.endswith("is not writeable"))