Skip to content

Commit d1afc17

Browse files
[Enabler][test_zos_tso_command_func] Update test suites on functional/modules/test_zos_tso_command_func.py to be pylint correct (#1480)
* Update test suites on functional/module-utils/test_zos_data_set_func.py to be pylint correct * Correct functional/modules/test_zos_data_set_func.py * Correct functional/modules/test_zos_data_set_func.py * Update test suites on functional/modules/test_zos_job_submit_func.py to be pylint correct * Remove accidental changes on functional/modules/test_zos_job_submit_func.py * Update test suites on functional/modules/test_zos_tso_command_func.py to be pylint correct * Update test_zos_tso_command_func.py --------- Co-authored-by: André Marcel Gutiérrez Benítez <[email protected]>
1 parent f5fbcd4 commit d1afc17

File tree

1 file changed

+13
-23
lines changed

1 file changed

+13
-23
lines changed

tests/functional/modules/test_zos_tso_command_func.py

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515

1616
__metaclass__ = type
1717

18-
import ansible.constants
19-
import ansible.errors
20-
import ansible.utils
2118
from ibm_zos_core.tests.helpers.dataset import get_tmp_ds_name
2219

2320
def test_zos_tso_command_run_help(ansible_zos_module):
@@ -50,7 +47,8 @@ def test_zos_tso_command_allocate_listing_delete(ansible_zos_module):
5047
hosts = ansible_zos_module
5148
default_temp_dataset = get_tmp_ds_name()
5249
command_string = [
53-
"alloc da('{0}') catalog lrecl(133) blksize(13300) recfm(f b) dsorg(po) cylinders space(5,5) dir(5)".format(default_temp_dataset)
50+
f"alloc da('{default_temp_dataset}') "+
51+
"catalog lrecl(133) blksize(13300) recfm(f b) dsorg(po) cylinders space(5,5) dir(5)"
5452
]
5553
results_allocate = hosts.all.zos_tso_command(commands=command_string)
5654
# Validate the correct allocation of dataset
@@ -59,34 +57,35 @@ def test_zos_tso_command_allocate_listing_delete(ansible_zos_module):
5957
assert item.get("rc") == 0
6058
assert result.get("changed") is True
6159
# Validate listds of datasets and validate LISTDS using alias param 'command' of auth command
62-
results = hosts.all.zos_tso_command(commands=["LISTDS '{0}'".format(default_temp_dataset)])
60+
results = hosts.all.zos_tso_command(commands=[f"LISTDS '{default_temp_dataset}'"])
6361
for result in results.contacted.values():
6462
for item in result.get("output"):
6563
assert item.get("rc") == 0
6664
assert result.get("changed") is True
6765
# Validate LISTDS using alias param 'command'
68-
results = hosts.all.zos_tso_command(command="LISTDS '{0}'".format(default_temp_dataset))
66+
results = hosts.all.zos_tso_command(command=f"LISTDS '{default_temp_dataset}'")
6967
for result in results.contacted.values():
7068
for item in result.get("output"):
7169
assert item.get("rc") == 0
7270
assert result.get("changed") is True
7371
# Validate LISTCAT command and an unauth command
7472
results = hosts.all.zos_tso_command(
75-
commands=["LISTCAT ENT('{0}')".format(default_temp_dataset)]
73+
commands=[f"LISTCAT ENT('{default_temp_dataset}')"]
7674
)
7775
for result in results.contacted.values():
7876
for item in result.get("output"):
7977
assert item.get("rc") == 0
8078
assert result.get("changed") is True
8179
# Validate remove dataset
82-
results = hosts.all.zos_tso_command(commands=["delete '{0}'".format(default_temp_dataset)])
80+
results = hosts.all.zos_tso_command(commands=[f"delete '{default_temp_dataset}'"])
8381
for result in results.contacted.values():
8482
for item in result.get("output"):
8583
assert item.get("rc") == 0
8684
assert result.get("changed") is True
87-
# Expect the tso_command to fail here because the previous command will have already deleted the data set
85+
# Expect the tso_command to fail here because
86+
# the previous command will have already deleted the data set
8887
# Validate data set was removed by previous call
89-
results = hosts.all.zos_tso_command(commands=["delete '{0}'".format(default_temp_dataset)])
88+
results = hosts.all.zos_tso_command(commands=[f"delete '{default_temp_dataset}'"])
9089
for result in results.contacted.values():
9190
for item in result.get("output"):
9291
assert item.get("rc") == 8
@@ -134,20 +133,11 @@ def test_zos_tso_command_multiple_commands(ansible_zos_module):
134133
# The command that kicks off rc>0 which is allowed
135134
def test_zos_tso_command_maxrc(ansible_zos_module):
136135
hosts = ansible_zos_module
137-
results = hosts.all.zos_tso_command(commands=["LISTDSD DATASET('HLQ.DATA.SET') ALL GENERIC"],max_rc=4)
138-
for result in results.contacted.values():
139-
for item in result.get("output"):
140-
assert item.get("rc") < 5
141-
assert result.get("changed") is True
142-
143-
144-
# The positive test
145-
# The command that kicks off rc>0 which is allowed
146-
def test_zos_tso_command_maxrc(ansible_zos_module):
147-
hosts = ansible_zos_module
148-
results = hosts.all.zos_tso_command(commands=["LISTDSD DATASET('HLQ.DATA.SET') ALL GENERIC"],max_rc=4)
136+
results = hosts.all.zos_tso_command(
137+
commands=["LISTDSD DATASET('HLQ.DATA.SET') ALL GENERIC"],
138+
max_rc=4
139+
)
149140
for result in results.contacted.values():
150141
for item in result.get("output"):
151-
print( item )
152142
assert item.get("rc") < 5
153143
assert result.get("changed") is True

0 commit comments

Comments
 (0)