Skip to content

Commit

Permalink
set attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
cmcmarrow committed Oct 5, 2023
1 parent 57a3b65 commit f54d6b7
Showing 1 changed file with 39 additions and 9 deletions.
48 changes: 39 additions & 9 deletions tests/pytests/functional/modules/test_win_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,45 @@ def test_get_attributes(tmp_path):


def test_set_attributes(tmp_path):
win_file.set_attributes(
path,
archive=None,
hidden=None,
normal=None,
notIndexed=None,
readonly=None,
system=None,
temporary=None)
tmp_path = str(tmp_path)
file = os.path.join(tmp_path, "t.txt")
with salt.utils.files.fopen(file, "w"):
pass
assert os.path.isfile(file) is True
assert win_file.set_attributes(
file,
archive=True,
hidden=True,
normal=False,
notIndexed=True,
readonly=True,
system=True,
temporary=True) is True
attributes = win_file.get_attributes(file)
assert attributes["archive"] is True
assert attributes["hidden"] is True
assert attributes["normal"] is False
assert attributes["notIndexed"] is True
assert attributes["readonly"] is True
assert attributes["system"] is True
assert attributes["temporary"] is True
assert win_file.set_attributes(
file,
archive=False,
hidden=False,
normal=True,
notIndexed=False,
readonly=False,
system=False,
temporary=False) is True
attributes = win_file.get_attributes(file)
assert attributes["archive"] is False
assert attributes["hidden"] is False
assert attributes["normal"] is True
assert attributes["notIndexed"] is False
assert attributes["readonly"] is False
assert attributes["system"] is False
assert attributes["temporary"] is False

def test_remove(tmp_path):
tmp_path = str(tmp_path)
Expand Down

0 comments on commit f54d6b7

Please sign in to comment.