forked from p15670423/monkey
Add unit test for Linux directory permissions (removed accidentally previously)
This commit is contained in:
parent
5d8db4b112
commit
f04f307f78
|
@ -46,6 +46,6 @@ def _create_secure_directory_windows(path: str):
|
||||||
win32file.CreateDirectory(path, security_attributes)
|
win32file.CreateDirectory(path, security_attributes)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
LOG.error(
|
LOG.error(
|
||||||
f'Could not create a directory at "{path}": {str(ex)}"
|
f'Could not create a directory at "{path}": {str(ex)}'
|
||||||
)
|
)
|
||||||
raise ex
|
raise ex
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import os
|
import os
|
||||||
|
import stat
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
@ -30,6 +31,13 @@ def test_create_secure_directory__no_parent_dir(test_path_nested):
|
||||||
create_secure_directory(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.")
|
@pytest.mark.skipif(not is_windows_os(), reason="Tests Windows (not Posix) permissions.")
|
||||||
def test_create_secure_directory__perm_windows(test_path):
|
def test_create_secure_directory__perm_windows(test_path):
|
||||||
import win32api
|
import win32api
|
||||||
|
|
Loading…
Reference in New Issue