2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-22 15:21:52 +00:00

test file permissions

This commit is contained in:
Philip Sargent 2023-02-02 14:51:20 +00:00
parent 578f02db2d
commit 18541de371

View File

@ -102,6 +102,33 @@ class PostTests(TestCase):
e.save() e.save()
self.expedition = e 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): def test_scan_upload(self):
"""Expect scan upload to wallet to work on any file """Expect scan upload to wallet to work on any file
Need to login first. Need to login first.