Skip to content

Commit

Permalink
Fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreMarcel99 committed Aug 22, 2024
1 parent d2e3b9b commit 04534b8
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions tests/functional/modules/test_zos_fetch_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import pytest
import string
import random
import tempfile

from hashlib import sha256
from ansible.utils.hashing import checksum
Expand Down Expand Up @@ -167,16 +168,15 @@ def test_fetch_uss_file_not_present_on_local_machine(ansible_zos_module):


def test_fetch_uss_file_replace_on_local_machine(ansible_zos_module):
tmp_path = get_unique_uss_file_name()
with open(tmp_path, "w",encoding="utf-8") as file:
with open("/tmp/profile", "w",encoding="utf-8") as file:
file.close()
hosts = ansible_zos_module
params = {
"src":"/etc/profile",
"dest":"/tmp/",
"flat":True
}
dest_path = tmp_path
dest_path = "/tmp/profile"
local_checksum = checksum(dest_path, hash_func=sha256)

try:
Expand All @@ -192,12 +192,12 @@ def test_fetch_uss_file_replace_on_local_machine(ansible_zos_module):

def test_fetch_uss_file_present_on_local_machine(ansible_zos_module):
hosts = ansible_zos_module
dest_path = get_unique_uss_file_name()
params = {
"src":"/etc/profile",
"dest": dest_path,
"dest": "/tmp/",
"flat":True
}
dest_path = "/tmp/profile"
hosts.all.zos_fetch(**params)
local_checksum = checksum(dest_path, hash_func=sha256)

Expand Down Expand Up @@ -705,7 +705,7 @@ def test_fetch_partitioned_data_set_replace_on_local_machine(ansible_zos_module)

def test_fetch_uss_file_insufficient_write_permission_fails(ansible_zos_module):
hosts = ansible_zos_module
dest_path = get_unique_uss_file_name()
dest_path = tempfile.TemporaryFile(delete=True, delete_on_close=False)
with open(dest_path, "w",encoding="utf-8") as dest_file:
dest_file.close()
os.chmod(dest_path, stat.S_IREAD)
Expand All @@ -714,13 +714,9 @@ def test_fetch_uss_file_insufficient_write_permission_fails(ansible_zos_module):
"dest": dest_path,
"flat":True
}
try:
results = hosts.all.zos_fetch(**params)
for result in results.contacted.values():
assert "msg" in result.keys()
finally:
if os.path.exists(dest_path):
os.remove(dest_path)
results = hosts.all.zos_fetch(**params)
for result in results.contacted.values():
assert "msg" in result.keys()


def test_fetch_pds_dir_insufficient_write_permission_fails(ansible_zos_module):
Expand Down

0 comments on commit 04534b8

Please sign in to comment.