Add unit test for Linux directory permissions (removed accidentally previously)

This commit is contained in:
shreyamalviya 2021-06-10 17:12:34 +05:30
parent 5d8db4b112
commit f04f307f78
2 changed files with 9 additions and 1 deletions

View File

@ -46,6 +46,6 @@ def _create_secure_directory_windows(path: str):
win32file.CreateDirectory(path, security_attributes)
except Exception as ex:
LOG.error(
f'Could not create a directory at "{path}": {str(ex)}"
f'Could not create a directory at "{path}": {str(ex)}'
)
raise ex

View File

@ -1,4 +1,5 @@
import os
import stat
import pytest
@ -30,6 +31,13 @@ def test_create_secure_directory__no_parent_dir(test_path_nested):
create_secure_directory(test_path_nested)
@pytest.mark.skipif(is_windows_os(), reason="Tests Posix (not Windows) permissions.")
def test_create_secure_directory__perm_linux(test_path):
create_secure_directory(test_path)
st = os.stat(test_path)
return bool(st.st_mode & stat.S_IRWXU)
@pytest.mark.skipif(not is_windows_os(), reason="Tests Windows (not Posix) permissions.")
def test_create_secure_directory__perm_windows(test_path):
import win32api