refactor tests, updated lib to cover write permission issue

Please work codecov
This commit is contained in:
Spitap
2023-02-25 10:44:30 +01:00
parent 6c1c6194ab
commit c7bcd80b17
3 changed files with 7 additions and 1 deletions
+6 -1
View File
@@ -18,8 +18,13 @@ from modoboa.parameters import tools as param_tools
def init_storage_dir():
"""Create the directory whare documents will be stored."""
storage_dir = param_tools.get_global_parameter("storage_dir")
if os.path.exists(storage_dir):
if os.path.exists(storage_dir) and os.access(storage_dir, os.W_OK):
return
elif not os.access(storage_dir, os.W_OK) and os.path.exists(storage_dir):
raise InternalError(
_("Can't write to selected directory to store PDF "
"documents")
)
try:
os.mkdir(storage_dir)
except (OSError, IOError) as inst:
+1
View File
@@ -0,0 +1 @@