forked from p15670423/monkey
island: Rename create_secure_file tests
create_secure_file() was previously renamed to get_file_descriptor_for_new_secure_file().
This commit is contained in:
parent
327ff7a626
commit
44bdfa5508
|
@ -56,7 +56,7 @@ def _get_acl_and_sid_from_path(path: str):
|
||||||
return acl, sid
|
return acl, sid
|
||||||
|
|
||||||
|
|
||||||
def test_create_secure_directory__already_created(test_path):
|
def test_create_secure_directory__already_exists(test_path):
|
||||||
os.mkdir(test_path)
|
os.mkdir(test_path)
|
||||||
assert os.path.isdir(test_path)
|
assert os.path.isdir(test_path)
|
||||||
create_secure_directory(test_path)
|
create_secure_directory(test_path)
|
||||||
|
@ -95,7 +95,7 @@ def test_create_secure_directory__perm_windows(test_path):
|
||||||
assert permissions == FULL_CONTROL and ace_type == ACE_TYPE_ALLOW
|
assert permissions == FULL_CONTROL and ace_type == ACE_TYPE_ALLOW
|
||||||
|
|
||||||
|
|
||||||
def test_create_secure_file__already_created(test_path):
|
def test_get_file_descriptor_for_new_secure_file__already_exists(test_path):
|
||||||
os.close(os.open(test_path, os.O_CREAT, stat.S_IRWXU))
|
os.close(os.open(test_path, os.O_CREAT, stat.S_IRWXU))
|
||||||
assert os.path.isfile(test_path)
|
assert os.path.isfile(test_path)
|
||||||
|
|
||||||
|
@ -103,13 +103,13 @@ def test_create_secure_file__already_created(test_path):
|
||||||
get_file_descriptor_for_new_secure_file(test_path)
|
get_file_descriptor_for_new_secure_file(test_path)
|
||||||
|
|
||||||
|
|
||||||
def test_create_secure_file__no_parent_dir(test_path_nested):
|
def test_get_file_descriptor_for_new_secure_file__no_parent_dir(test_path_nested):
|
||||||
with pytest.raises(Exception):
|
with pytest.raises(Exception):
|
||||||
get_file_descriptor_for_new_secure_file(test_path_nested)
|
get_file_descriptor_for_new_secure_file(test_path_nested)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(is_windows_os(), reason="Tests Posix (not Windows) permissions.")
|
@pytest.mark.skipif(is_windows_os(), reason="Tests Posix (not Windows) permissions.")
|
||||||
def test_create_secure_file__perm_linux(test_path):
|
def test_get_file_descriptor_for_new_secure_file__perm_linux(test_path):
|
||||||
os.close(get_file_descriptor_for_new_secure_file(test_path))
|
os.close(get_file_descriptor_for_new_secure_file(test_path))
|
||||||
st = os.stat(test_path)
|
st = os.stat(test_path)
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ def test_create_secure_file__perm_linux(test_path):
|
||||||
|
|
||||||
|
|
||||||
@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_file__perm_windows(test_path):
|
def test_get_file_descriptor_for_new_secure_file__perm_windows(test_path):
|
||||||
win32file.CloseHandle(get_file_descriptor_for_new_secure_file(test_path))
|
win32file.CloseHandle(get_file_descriptor_for_new_secure_file(test_path))
|
||||||
|
|
||||||
acl, user_sid = _get_acl_and_sid_from_path(test_path)
|
acl, user_sid = _get_acl_and_sid_from_path(test_path)
|
||||||
|
|
Loading…
Reference in New Issue