diff options
author | Philip Sargent <philip.sargent@gmail.com> | 2023-02-02 14:51:20 +0000 |
---|---|---|
committer | Philip Sargent <philip.sargent@gmail.com> | 2023-02-02 14:51:20 +0000 |
commit | 18541de37143a91bcf937503971420c804c8388a (patch) | |
tree | 26e791d4df6cf30ca63a196c9e8ad624f60fe38f /core/TESTS/tests_logins.py | |
parent | 578f02db2def16e18967af1ff947657a1a5efe11 (diff) | |
download | troggle-18541de37143a91bcf937503971420c804c8388a.tar.gz troggle-18541de37143a91bcf937503971420c804c8388a.tar.bz2 troggle-18541de37143a91bcf937503971420c804c8388a.zip |
test file permissions
Diffstat (limited to 'core/TESTS/tests_logins.py')
-rw-r--r-- | core/TESTS/tests_logins.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/core/TESTS/tests_logins.py b/core/TESTS/tests_logins.py index 0e6da96..81ba976 100644 --- a/core/TESTS/tests_logins.py +++ b/core/TESTS/tests_logins.py @@ -102,6 +102,33 @@ class PostTests(TestCase): e.save() self.expedition = e + def test_file_permissions(self): + """Expect to be allowed to write to expofiles + Need to login first. + """ + c = self.client + from django.contrib.auth.models import User + + u = User.objects.get(username="expotest") + testyear = self.testyear + + self.assertTrue(u.is_active, "User '" + u.username + "' is INACTIVE") + c.login(username=u.username, password="secretword") + + for p in [settings.SCANS_ROOT, + settings.DRAWINGS_DATA / "walletjson", + settings.EXPOWEB / "documents", + settings.SURVEX_DATA / "docs" + ]: + + _test_file_path = pathlib.Path(p, "_created_by_test_suite.txt") + self.assertEqual(_test_file_path.is_file(), False) + + with open(_test_file_path, "w") as f: + f.write("test string: can we write to this directory?") + self.assertEqual(_test_file_path.is_file(), True) + #_test_file_path.unlink() + def test_scan_upload(self): """Expect scan upload to wallet to work on any file Need to login first. |