@@ -41,181 +41,8 @@ def test_calculate_end_time():
41
41
timeout_seconds = 10
42
42
stop_region_action .get_datetime_now = MagicMock (return_value = now )
43
43
44
- assert calculate_end_time (timeout_seconds ) == now + timedelta (0 , timeout_seconds )
45
-
46
-
47
- # def test_get_job_status_name_id_running():
48
- # tso_response = get_tso_status_response()
49
- # job_name = "LINKJOB"
50
- # job_id = "JOB12345"
51
- # assert get_job_status_name_id(tso_response, job_name, job_id) == "EXECUTING"
52
-
53
-
54
- # def test_get_job_status_name_id_stopped():
55
- # tso_response = get_tso_status_response(running=0)
56
- # job_name = "LINKJOB"
57
- # job_id = "JOB98765"
58
- # assert get_job_status_name_id(tso_response, job_name, job_id) == "ON OUTPUT QUEUE"
59
-
60
-
61
- # def test_get_job_status_name_id_empty():
62
- # tso_response = get_tso_status_response(running=0, stopped=0)
63
- # job_name = "LINKJOB"
64
- # job_id = "JOB98765"
65
-
66
- # with pytest.raises(AnsibleActionFail) as action_err:
67
- # get_job_status_name_id(tso_response, job_name, job_id)
68
- # assert "No jobs found with name {0} and ID {1}".format(job_name, job_id) in str(
69
- # action_err
70
- # )
71
-
72
-
73
- # def test_get_job_status_name_id_multiple():
74
- # tso_response = get_tso_status_response(running=2, stopped=1)
75
- # job_name = "LINKJOB"
76
- # job_id = "JOB12345"
77
-
78
- # with pytest.raises(AnsibleActionFail) as action_err:
79
- # get_job_status_name_id(tso_response, job_name, job_id)
80
- # assert "Multiple jobs with name and ID found" in str(action_err)
81
-
82
-
83
- # def test_get_job_status_name_id_no_output():
84
- # tso_response = {"output": []}
85
- # job_name = "LINKJOB"
86
- # job_id = "JOB12345"
87
-
88
- # with pytest.raises(AnsibleActionFail) as action_err:
89
- # get_job_status_name_id(tso_response, job_name, job_id)
90
- # assert "Output not received for TSO STATUS command" in str(action_err)
91
-
92
-
93
- # def test_get_job_status_name_id_too_many_outputs():
94
- # tso_response = {"output": ["COMMAND 1 OUTPUT", "COMMAND 2 OUTPUT"]}
95
- # job_name = "LINKJOB"
96
- # job_id = "JOB12345"
97
-
98
- # with pytest.raises(AnsibleActionFail) as action_err:
99
- # get_job_status_name_id(tso_response, job_name, job_id)
100
- # assert "Output not received for TSO STATUS command" in str(action_err)
101
-
102
-
103
- # def test_get_executing_jobs_from_tso_output_1():
104
- # job_name = "LINKJOB"
105
- # job_id = "JOB12345"
106
- # tso_response = get_tso_status_response(
107
- # full_response=False, running=1, jobname=job_name, running_job_id=job_id
108
- # )
109
-
110
- # executing_jobs = get_executing_jobs_from_tso_output(tso_response)
111
- # assert len(executing_jobs) == 1
112
- # assert executing_jobs[0] == "IKJ56211I JOB {0}({1}) EXECUTING".format(
113
- # job_name, job_id
114
- # )
115
-
116
-
117
- # def test_get_executing_jobs_from_tso_output_2():
118
- # job_name = "LINKJOB"
119
- # job_id = "JOB12345"
120
- # tso_response = get_tso_status_response(
121
- # full_response=False, running=2, jobname=job_name, running_job_id=job_id
122
- # )
123
-
124
- # executing_jobs = get_executing_jobs_from_tso_output(tso_response)
125
- # assert len(executing_jobs) == 2
126
- # assert executing_jobs[1] == "IKJ56211I JOB {0}({1}) EXECUTING".format(
127
- # job_name, job_id
128
- # )
129
-
130
-
131
- # def test_get_executing_jobs_from_tso_output_0():
132
- # job_name = "LINKJOB"
133
- # job_id = "JOB12345"
134
- # tso_response = get_tso_status_response(
135
- # full_response=False, running=0, jobname=job_name, running_job_id=job_id
136
- # )
137
-
138
- # executing_jobs = get_executing_jobs_from_tso_output(tso_response)
139
- # assert len(executing_jobs) == 0
140
-
141
-
142
- # def test_extract_id_from_executing_job_line():
143
- # job_id = "JOB12345"
144
- # job_line = "IKJ56211I JOB JOBNAME({0}) EXECUTING".format(job_id)
145
- # assert extract_id_from_executing_job_line(job_line) == job_id
146
-
147
-
148
- # def test_get_running_job_id_from_name_no_output():
149
- # tso_response = {"output": []}
150
-
151
- # with pytest.raises(AnsibleActionFail) as action_err:
152
- # get_running_job_id_from_name(tso_response)
153
- # assert "Output not received for TSO STATUS command" in str(action_err)
154
-
155
-
156
- # def test_get_running_job_id_from_name_0():
157
- # tso_response = get_tso_status_response(running=0)
158
- # assert get_running_job_id_from_name(tso_response) is None
159
-
160
-
161
- # def test_get_running_job_id_from_name_1():
162
- # job_id = "JOB12345"
163
- # tso_response = get_tso_status_response(running_job_id=job_id)
164
- # assert get_running_job_id_from_name(tso_response) == job_id
165
-
166
-
167
- # def test_get_running_job_id_from_name_2():
168
- # tso_response = get_tso_status_response(running=2)
169
-
170
- # with pytest.raises(AnsibleActionFail) as action_err:
171
- # get_running_job_id_from_name(tso_response)
172
- # assert "More than 1 job running" in str(action_err)
173
-
174
-
175
- # def test_get_job_name_from_id_failed_no_msg():
176
- # job_query_response = get_job_query_result(failed=True)
177
- # job_id = "JOB12345"
178
-
179
- # with pytest.raises(AnsibleActionFail) as action_err:
180
- # get_job_name_from_id(job_query_response, job_id)
181
- # assert "Job query failed - (No failure message provided by zos_job_query)" in str(
182
- # action_err
183
- # )
184
-
185
-
186
- # def test_get_job_name_from_id_failed_msg():
187
- # job_query_response = get_job_query_result(failed=True, message="MEANINGFUL ERROR")
188
- # job_id = "JOB12345"
189
-
190
- # with pytest.raises(AnsibleActionFail) as action_err:
191
- # get_job_name_from_id(job_query_response, job_id)
192
- # assert "Job query failed - MEANINGFUL ERROR" in str(action_err)
193
-
194
-
195
- # def test_get_job_name_from_id_0():
196
- # job_query_response = get_job_query_result(jobs=0)
197
- # job_id = "JOB12345"
198
-
199
- # with pytest.raises(AnsibleActionFail) as action_err:
200
- # get_job_name_from_id(job_query_response, job_id)
201
- # assert "No jobs found with id {0}".format(job_id) in str(action_err)
202
-
203
-
204
- # def test_get_job_name_from_id_1():
205
- # job_id = "JOB12345"
206
- # job_name = "AN1234"
207
- # job_query_response = get_job_query_result(jobs=1, jobname=job_name)
208
-
209
- # assert get_job_name_from_id(job_query_response, job_id) == job_name
210
-
211
-
212
- # def test_get_job_name_from_id_2():
213
- # job_query_response = get_job_query_result(jobs=2)
214
- # job_id = "JOB12345"
215
-
216
- # with pytest.raises(AnsibleActionFail) as action_err:
217
- # get_job_name_from_id(job_query_response, job_id)
218
- # assert "Multiple jobs found with ID {0}".format(job_id) in str(action_err)
44
+ assert calculate_end_time (timeout_seconds ) == now + \
45
+ timedelta (0 , timeout_seconds )
219
46
220
47
221
48
def test_format_cancel_command ():
@@ -265,7 +92,8 @@ def test_console_error_valid():
265
92
get_console_errors (shutdown_result )
266
93
assert True
267
94
except Exception as e :
268
- assert False , "'get_console_errors' raised exception {0}" .format (str (e ))
95
+ assert False , "'get_console_errors' raised exception {0}" .format (
96
+ str (e ))
269
97
270
98
271
99
def test_console_error_undefined ():
@@ -279,7 +107,8 @@ def test_console_error_undefined():
279
107
280
108
281
109
def test_console_error_install ():
282
- shutdown_result = get_operator_shutdown_response (console = CONSOLE_AUTOINSTALL_FAIL )
110
+ shutdown_result = get_operator_shutdown_response (
111
+ console = CONSOLE_AUTOINSTALL_FAIL )
283
112
284
113
with pytest .raises (AnsibleActionFail ) as action_err :
285
114
get_console_errors (shutdown_result )
@@ -307,7 +136,8 @@ def test_get_job_info_from_status_1_running():
307
136
308
137
def test_get_job_info_from_status_0_running ():
309
138
job_name = "JOBNAM"
310
- tso_query_response = get_tso_status_response (jobname = job_name , stopped = 0 , running = 0 )
139
+ tso_query_response = get_tso_status_response (
140
+ jobname = job_name , stopped = 0 , running = 0 )
311
141
assert _get_job_info_from_status (tso_query_response , job_name ) == []
312
142
313
143
@@ -441,7 +271,8 @@ def test_get_job_name_from_query_0_jobs():
441
271
def test_get_job_name_from_query_missing_jobs ():
442
272
job_name = "JOBNAM"
443
273
job_id = "JOB12345"
444
- job_query_response = get_job_query_result (jobname = job_name , no_jobs_found = True )
274
+ job_query_response = get_job_query_result (
275
+ jobname = job_name , no_jobs_found = True )
445
276
446
277
with pytest .raises (AnsibleActionFail ) as action_err :
447
278
_get_job_name_from_query (job_query_response , job_id )
@@ -465,7 +296,8 @@ def test_get_job_status_name_id():
465
296
tso_query_response = get_tso_status_response (
466
297
jobname = job_name , running_job_id = job_id , stopped_job_id = stopped_id
467
298
)
468
- assert _get_job_status_name_id (tso_query_response , job_name , job_id ) == "EXECUTING"
299
+ assert _get_job_status_name_id (
300
+ tso_query_response , job_name , job_id ) == "EXECUTING"
469
301
470
302
471
303
def test_get_job_status_name_id_no_output ():
@@ -479,7 +311,8 @@ def test_get_job_status_name_id_no_output():
479
311
def test_get_job_status_name_id_0_jobs ():
480
312
job_name = "JOBNAM"
481
313
job_id = "JOB12345"
482
- tso_query_response = get_tso_status_response (jobname = job_name , running = 0 , stopped = 0 )
314
+ tso_query_response = get_tso_status_response (
315
+ jobname = job_name , running = 0 , stopped = 0 )
483
316
with pytest .raises (AnsibleActionFail ) as action_err :
484
317
_get_job_status_name_id (tso_query_response , job_name , job_id )
485
318
assert "No jobs found with name {0} and ID {1}" .format (job_name , job_id ) in str (
@@ -490,7 +323,8 @@ def test_get_job_status_name_id_0_jobs():
490
323
def test_get_job_status_name_id_2_jobs ():
491
324
job_name = "JOBNAM"
492
325
job_id = "JOB12345"
493
- tso_query_response = get_tso_status_response (jobname = job_name , running = 2 , stopped = 0 )
326
+ tso_query_response = get_tso_status_response (
327
+ jobname = job_name , running = 2 , stopped = 0 )
494
328
with pytest .raises (AnsibleActionFail ) as action_err :
495
329
_get_job_status_name_id (tso_query_response , job_name , job_id )
496
330
assert "Multiple jobs with name and ID found" in str (action_err )
0 commit comments