@@ -114,7 +114,7 @@ def test_validate_for_aap_credential(
114
114
115
115
@pytest .mark .django_db
116
116
def test_is_activation_valid_with_token_and_run_job_template (
117
- default_de : models .DecisionEnvironment ,
117
+ default_decision_environment : models .DecisionEnvironment ,
118
118
default_rulebook_with_run_job_template : models .Rulebook ,
119
119
default_project : models .Project ,
120
120
default_user_awx_token : models .AwxToken ,
@@ -125,7 +125,7 @@ def test_is_activation_valid_with_token_and_run_job_template(
125
125
name = "test" ,
126
126
description = "test activation" ,
127
127
rulebook_id = default_rulebook_with_run_job_template .id ,
128
- decision_environment_id = default_de .id ,
128
+ decision_environment_id = default_decision_environment .id ,
129
129
project_id = default_project .id ,
130
130
awx_token_id = default_user_awx_token .id ,
131
131
user_id = default_user .id ,
@@ -158,7 +158,7 @@ def test_is_activation_valid_with_aap_credential_and_run_job_template(
158
158
159
159
@pytest .mark .django_db
160
160
def test_is_activation_valid_with_run_job_template_and_no_token_no_credential (
161
- default_de : models .DecisionEnvironment ,
161
+ default_decision_environment : models .DecisionEnvironment ,
162
162
default_rulebook_with_run_job_template : models .Rulebook ,
163
163
default_project : models .Project ,
164
164
default_user : models .User ,
@@ -168,7 +168,7 @@ def test_is_activation_valid_with_run_job_template_and_no_token_no_credential(
168
168
name = "test" ,
169
169
description = "test activation" ,
170
170
rulebook_id = default_rulebook_with_run_job_template .id ,
171
- decision_environment_id = default_de .id ,
171
+ decision_environment_id = default_decision_environment .id ,
172
172
project_id = default_project .id ,
173
173
user_id = default_user .id ,
174
174
)
@@ -186,7 +186,7 @@ def test_is_activation_valid_with_updated_credential(
186
186
default_activation : models .Activation ,
187
187
default_organization : models .Organization ,
188
188
user_credential_type : models .CredentialType ,
189
- client : APIClient ,
189
+ admin_client : APIClient ,
190
190
preseed_credential_types ,
191
191
):
192
192
credential = models .EdaCredential .objects .create (
@@ -202,7 +202,7 @@ def test_is_activation_valid_with_updated_credential(
202
202
)
203
203
default_activation .eda_credentials .add (credential )
204
204
205
- response = client .post (
205
+ response = admin_client .post (
206
206
f"{ api_url_v1 } /activations/{ default_activation .id } /restart/"
207
207
)
208
208
assert response .status_code == status .HTTP_204_NO_CONTENT
@@ -215,7 +215,7 @@ def test_is_activation_valid_with_updated_credential(
215
215
216
216
@pytest .mark .django_db
217
217
def test_create_activation_with_eda_credential (
218
- client : APIClient ,
218
+ admin_client : APIClient ,
219
219
kafka_credential_type : models .CredentialType ,
220
220
activation_payload : Dict [str , Any ],
221
221
preseed_credential_types ,
@@ -233,12 +233,14 @@ def test_create_activation_with_eda_credential(
233
233
"inputs" : {"sasl_username" : "adam" , "sasl_password" : "secret" },
234
234
"credential_type_id" : kafka_credential_type .id ,
235
235
}
236
- response = client .post (
236
+ response = admin_client .post (
237
237
f"{ api_url_v1 } /eda-credentials/" , data = test_eda_credential
238
238
)
239
239
test_activation ["eda_credentials" ] = [response .data ["id" ]]
240
240
241
- response = client .post (f"{ api_url_v1 } /activations/" , data = test_activation )
241
+ response = admin_client .post (
242
+ f"{ api_url_v1 } /activations/" , data = test_activation
243
+ )
242
244
assert response .status_code == status .HTTP_201_CREATED
243
245
data = response .data
244
246
assert data ["eda_credentials" ][0 ]["credential_type" ] == {
@@ -266,15 +268,15 @@ def test_create_activation_with_eda_credential(
266
268
267
269
@pytest .mark .django_db
268
270
def test_create_activation_with_key_conflict (
269
- client : APIClient ,
270
- default_de : models .DecisionEnvironment ,
271
+ admin_client : APIClient ,
272
+ default_decision_environment : models .DecisionEnvironment ,
271
273
default_rulebook : models .Rulebook ,
272
274
kafka_credential_type : models .CredentialType ,
273
275
preseed_credential_types ,
274
276
):
275
277
test_activation = {
276
278
"name" : "test_activation" ,
277
- "decision_environment_id" : default_de .id ,
279
+ "decision_environment_id" : default_decision_environment .id ,
278
280
"rulebook_id" : default_rulebook .id ,
279
281
"extra_var" : OVERLAP_EXTRA_VAR ,
280
282
}
@@ -286,7 +288,9 @@ def test_create_activation_with_key_conflict(
286
288
)
287
289
test_activation ["eda_credentials" ] = [test_eda_credential .id ]
288
290
289
- response = client .post (f"{ api_url_v1 } /activations/" , data = test_activation )
291
+ response = admin_client .post (
292
+ f"{ api_url_v1 } /activations/" , data = test_activation
293
+ )
290
294
assert response .status_code == status .HTTP_400_BAD_REQUEST
291
295
assert (
292
296
"Key: sasl_plain_password already exists "
@@ -297,7 +301,7 @@ def test_create_activation_with_key_conflict(
297
301
298
302
@pytest .mark .django_db
299
303
def test_create_activation_with_conflict_credentials (
300
- client : APIClient ,
304
+ admin_client : APIClient ,
301
305
activation_payload : Dict [str , Any ],
302
306
user_credential_type : models .CredentialType ,
303
307
preseed_credential_types ,
@@ -328,7 +332,9 @@ def test_create_activation_with_conflict_credentials(
328
332
eda_credential_ids = [credential .id for credential in eda_credentials ]
329
333
test_activation ["eda_credentials" ] = eda_credential_ids
330
334
331
- response = client .post (f"{ api_url_v1 } /activations/" , data = test_activation )
335
+ response = admin_client .post (
336
+ f"{ api_url_v1 } /activations/" , data = test_activation
337
+ )
332
338
assert response .status_code == status .HTTP_400_BAD_REQUEST
333
339
assert (
334
340
"Key: sasl_password already exists "
@@ -339,15 +345,15 @@ def test_create_activation_with_conflict_credentials(
339
345
340
346
@pytest .mark .django_db
341
347
def test_create_activation_without_extra_vars_single_credential (
342
- client : APIClient ,
343
- default_de : models .DecisionEnvironment ,
348
+ admin_client : APIClient ,
349
+ default_decision_environment : models .DecisionEnvironment ,
344
350
default_rulebook : models .Rulebook ,
345
351
user_credential_type : models .CredentialType ,
346
352
preseed_credential_types ,
347
353
):
348
354
test_activation = {
349
355
"name" : "test_activation" ,
350
- "decision_environment_id" : default_de .id ,
356
+ "decision_environment_id" : default_decision_environment .id ,
351
357
"rulebook_id" : default_rulebook .id ,
352
358
"extra_var" : None ,
353
359
}
@@ -362,7 +368,9 @@ def test_create_activation_without_extra_vars_single_credential(
362
368
test_activation ["eda_credentials" ] = eda_credential_ids
363
369
364
370
assert not test_activation ["extra_var" ]
365
- response = client .post (f"{ api_url_v1 } /activations/" , data = test_activation )
371
+ response = admin_client .post (
372
+ f"{ api_url_v1 } /activations/" , data = test_activation
373
+ )
366
374
assert response .status_code == status .HTTP_201_CREATED
367
375
assert response .data ["extra_var" ]
368
376
extra_var = yaml .safe_load (response .data ["extra_var" ])
@@ -372,15 +380,15 @@ def test_create_activation_without_extra_vars_single_credential(
372
380
373
381
@pytest .mark .django_db
374
382
def test_create_activation_without_extra_vars_duplicate_credentials (
375
- client : APIClient ,
376
- default_de : models .DecisionEnvironment ,
383
+ admin_client : APIClient ,
384
+ default_decision_environment : models .DecisionEnvironment ,
377
385
default_rulebook : models .Rulebook ,
378
386
user_credential_type : models .CredentialType ,
379
387
preseed_credential_types ,
380
388
):
381
389
test_activation = {
382
390
"name" : "test_activation" ,
383
- "decision_environment_id" : default_de .id ,
391
+ "decision_environment_id" : default_decision_environment .id ,
384
392
"rulebook_id" : default_rulebook .id ,
385
393
}
386
394
@@ -402,7 +410,9 @@ def test_create_activation_without_extra_vars_duplicate_credentials(
402
410
eda_credential_ids = [credential .id for credential in eda_credentials ]
403
411
test_activation ["eda_credentials" ] = eda_credential_ids
404
412
405
- response = client .post (f"{ api_url_v1 } /activations/" , data = test_activation )
413
+ response = admin_client .post (
414
+ f"{ api_url_v1 } /activations/" , data = test_activation
415
+ )
406
416
assert response .status_code == status .HTTP_400_BAD_REQUEST
407
417
assert (
408
418
"Key: sasl_password already exists in extra var. It conflicts with"
0 commit comments