Skip to content

Commit 7b6becb

Browse files
IsaacVReyAndreMarcel99ddimatos
authored
[Enabler][test_zos_find_func] Update test suites on functional/modules/test_zos_find_func.py to be pylint correct (#1459)
* 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_find_func.py to be pylint correct * Fix typo --------- Co-authored-by: André Marcel Gutiérrez Benítez <[email protected]> Co-authored-by: André Marcel Gutiérrez Benítez <[email protected]> Co-authored-by: Demetri <[email protected]>
1 parent b329b00 commit 7b6becb

File tree

1 file changed

+124
-36
lines changed

1 file changed

+124
-36
lines changed

tests/functional/modules/test_zos_find_func.py

Lines changed: 124 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,16 @@
4444

4545
def create_vsam_ksds(ds_name, ansible_zos_module, volume="000000"):
4646
hosts = ansible_zos_module
47-
alloc_cmd = """ DEFINE CLUSTER (NAME({0}) -
47+
alloc_cmd = f""" DEFINE CLUSTER (NAME({ds_name}) -
4848
INDEXED -
4949
RECSZ(80,80) -
5050
TRACKS(1,1) -
5151
KEYS(5,0) -
5252
CISZ(4096) -
53-
VOLUMES({1}) -
53+
VOLUMES({volume}) -
5454
FREESPACE(3,3) ) -
55-
DATA (NAME({0}.DATA)) -
56-
INDEX (NAME({0}.INDEX))""".format(
57-
ds_name, volume
58-
)
59-
55+
DATA (NAME({ds_name}.DATA)) -
56+
INDEX (NAME({ds_name}.INDEX))"""
6057
return hosts.all.shell(
6158
cmd="mvscmdauth --pgm=idcams --sysprint=* --sysin=stdin",
6259
executable='/bin/sh',
@@ -132,7 +129,13 @@ def test_find_sequential_data_sets_containing_single_string(ansible_zos_module):
132129
search_string = "hello"
133130
try:
134131
hosts.all.zos_data_set(
135-
batch=[dict(name=i, type='seq', state='present') for i in SEQ_NAMES]
132+
batch=[
133+
{
134+
"name":i,
135+
"type":'seq',
136+
"state":'present'
137+
} for i in SEQ_NAMES
138+
]
136139
)
137140
for ds in SEQ_NAMES:
138141
hosts.all.shell(cmd=f"decho '{search_string}' \"{ds}\" ")
@@ -149,7 +152,12 @@ def test_find_sequential_data_sets_containing_single_string(ansible_zos_module):
149152
assert val.get('matched') == len(val.get('data_sets'))
150153
finally:
151154
hosts.all.zos_data_set(
152-
batch=[dict(name=i, state='absent') for i in SEQ_NAMES]
155+
batch=[
156+
{
157+
"name":i,
158+
"state":'absent'
159+
} for i in SEQ_NAMES
160+
]
153161
)
154162

155163

@@ -159,7 +167,13 @@ def test_find_sequential_data_sets_multiple_patterns(ansible_zos_module):
159167
new_ds = "TEST.FIND.SEQ.FUNCTEST.FOURTH"
160168
try:
161169
hosts.all.zos_data_set(
162-
batch=[dict(name=i, type='seq', state='present') for i in SEQ_NAMES]
170+
batch=[
171+
{
172+
"name":i,
173+
"type":'seq',
174+
"state":'present'
175+
} for i in SEQ_NAMES
176+
]
163177
)
164178
hosts.all.zos_data_set(name=new_ds, type='seq', state='present')
165179
hosts.all.shell(cmd=f"decho 'incorrect string' \"{new_ds}\" ")
@@ -177,7 +191,12 @@ def test_find_sequential_data_sets_multiple_patterns(ansible_zos_module):
177191
assert val.get('matched') == len(val.get('data_sets'))
178192
finally:
179193
hosts.all.zos_data_set(
180-
batch=[dict(name=i, state='absent') for i in SEQ_NAMES]
194+
batch=[
195+
{
196+
"name":i,
197+
"state":'absent'
198+
} for i in SEQ_NAMES
199+
]
181200
)
182201
hosts.all.zos_data_set(
183202
name=new_ds, state='absent'
@@ -189,16 +208,23 @@ def test_find_pds_members_containing_string(ansible_zos_module):
189208
search_string = "hello"
190209
try:
191210
hosts.all.zos_data_set(
192-
batch=[dict(name=i, type='pds', space_primary=1, space_type="m") for i in PDS_NAMES]
211+
batch=[
212+
{
213+
"name":i,
214+
"type":'pds',
215+
"space_primary":1,
216+
"space_type":"m",
217+
} for i in PDS_NAMES
218+
]
193219
)
194220
hosts.all.zos_data_set(
195221
batch=[
196-
dict(
197-
name=i + "(MEMBER)",
198-
type="member",
199-
state='present',
200-
replace='yes'
201-
) for i in PDS_NAMES
222+
{
223+
"name":i + "(MEMBER)",
224+
"type":"member",
225+
"state":'present',
226+
"replace":'yes',
227+
} for i in PDS_NAMES
202228
]
203229
)
204230
for ds in PDS_NAMES:
@@ -216,7 +242,12 @@ def test_find_pds_members_containing_string(ansible_zos_module):
216242
assert len(ds.get('members')) == 1
217243
finally:
218244
hosts.all.zos_data_set(
219-
batch=[dict(name=i, state='absent') for i in PDS_NAMES]
245+
batch=[
246+
{
247+
"name":i,
248+
"state":'absent'
249+
} for i in PDS_NAMES
250+
]
220251
)
221252

222253

@@ -225,12 +256,12 @@ def test_exclude_data_sets_from_matched_list(ansible_zos_module):
225256
try:
226257
hosts.all.zos_data_set(
227258
batch=[
228-
dict(
229-
name=i,
230-
type='seq',
231-
record_length=80,
232-
state='present'
233-
) for i in SEQ_NAMES
259+
{
260+
"name":i,
261+
"type":'seq',
262+
"record_length":80,
263+
"state":'present'
264+
} for i in SEQ_NAMES
234265
]
235266
)
236267
find_res = hosts.all.zos_find(
@@ -243,21 +274,42 @@ def test_exclude_data_sets_from_matched_list(ansible_zos_module):
243274
assert ds.get('name') in SEQ_NAMES
244275
finally:
245276
hosts.all.zos_data_set(
246-
batch=[dict(name=i, state='absent') for i in SEQ_NAMES]
277+
batch=[
278+
{
279+
"name":i,
280+
"state":'absent'
281+
} for i in SEQ_NAMES
282+
]
247283
)
248284

249285

250286
def test_exclude_members_from_matched_list(ansible_zos_module):
251287
hosts = ansible_zos_module
252288
try:
253289
hosts.all.zos_data_set(
254-
batch=[dict(name=i, type='pds', state='present') for i in PDS_NAMES]
290+
batch=[
291+
{
292+
"name":i,
293+
"type":'pds',
294+
"state":'present'
295+
} for i in PDS_NAMES
296+
]
255297
)
256298
hosts.all.zos_data_set(
257-
batch=[dict(name=i + "(MEMBER)", type="member") for i in PDS_NAMES]
299+
batch=[
300+
{
301+
"name":i + "(MEMBER)",
302+
"type":"member"
303+
} for i in PDS_NAMES
304+
]
258305
)
259306
hosts.all.zos_data_set(
260-
batch=[dict(name=i + "(FILE)", type="member") for i in PDS_NAMES]
307+
batch=[
308+
{
309+
"name":i + "(FILE)",
310+
"type":"member"
311+
} for i in PDS_NAMES
312+
]
261313
)
262314
find_res = hosts.all.zos_find(
263315
pds_paths=['TEST.FIND.PDS.FUNCTEST.*'], excludes=['.*FILE$'], patterns=['.*']
@@ -268,7 +320,12 @@ def test_exclude_members_from_matched_list(ansible_zos_module):
268320
assert len(ds.get('members')) == 1
269321
finally:
270322
hosts.all.zos_data_set(
271-
batch=[dict(name=i, state='absent') for i in PDS_NAMES]
323+
batch=[
324+
{
325+
"name":i,
326+
"state":'absent'
327+
} for i in PDS_NAMES
328+
]
272329
)
273330

274331

@@ -344,7 +401,12 @@ def test_find_vsam_pattern(ansible_zos_module):
344401
assert val.get('matched') == len(val.get('data_sets'))
345402
finally:
346403
hosts.all.zos_data_set(
347-
batch=[dict(name=i, state='absent') for i in VSAM_NAMES]
404+
batch=[
405+
{
406+
"name":i,
407+
"state":'absent'
408+
} for i in VSAM_NAMES
409+
]
348410
)
349411

350412

@@ -366,7 +428,12 @@ def test_find_vsam_in_volume(ansible_zos_module, volumes_on_systems):
366428
assert val.get('matched') == len(val.get('data_sets'))
367429
finally:
368430
hosts.all.zos_data_set(
369-
batch=[dict(name=i, state='absent') for i in VSAM_NAMES]
431+
batch=[
432+
{
433+
"name":i,
434+
"state":'absent'
435+
} for i in VSAM_NAMES
436+
]
370437
)
371438
hosts.all.zos_data_set(name=alternate_vsam, state='absent')
372439

@@ -405,13 +472,29 @@ def test_find_mixed_members_from_pds_paths(ansible_zos_module):
405472
hosts = ansible_zos_module
406473
try:
407474
hosts.all.zos_data_set(
408-
batch=[dict(name=i, type='pds', state='present') for i in PDS_NAMES]
475+
batch=[
476+
{
477+
"name":i,
478+
"type":'pds',
479+
"state":'present'
480+
} for i in PDS_NAMES
481+
]
409482
)
410483
hosts.all.zos_data_set(
411-
batch=[dict(name=i + "(MEMBER)", type="member") for i in PDS_NAMES]
484+
batch=[
485+
{
486+
"name":i + "(MEMBER)",
487+
"type":"member"
488+
} for i in PDS_NAMES
489+
]
412490
)
413491
hosts.all.zos_data_set(
414-
batch=[dict(name=i + "(FILE)", type="member") for i in PDS_NAMES]
492+
batch=[
493+
{
494+
"name":i + "(FILE)",
495+
"type":"member"
496+
} for i in PDS_NAMES
497+
]
415498
)
416499
find_res = hosts.all.zos_find(
417500
pds_paths=['TEST.NONE.PDS.*','TEST.FIND.PDS.FUNCTEST.*'], excludes=['.*FILE$'], patterns=['.*']
@@ -422,7 +505,12 @@ def test_find_mixed_members_from_pds_paths(ansible_zos_module):
422505
assert len(ds.get('members')) == 1
423506
finally:
424507
hosts.all.zos_data_set(
425-
batch=[dict(name=i, state='absent') for i in PDS_NAMES]
508+
batch=[
509+
{
510+
"name":i,
511+
"state":'absent'
512+
} for i in PDS_NAMES
513+
]
426514
)
427515

428516

0 commit comments

Comments
 (0)