mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 23:07:42 -02:30
Finish JT.credentials functionality, add test
Original commit: commit 3ec6196477135230c4b90b175310bdc2eaff36ed Author: David Moreau Simard <dmsimard@redhat.com> Date: Tue Oct 23 22:21:33 2018 -0400 Add support for "credentials" in the tower_job_template module Job templates might require more than one credential. There's credential, vault_credential, machine_credential, etc. "credentials" is a thing, let's support it.
This commit is contained in:
committed by
AlanCoding
parent
c4143b0111
commit
2171823846
@@ -80,3 +80,29 @@ def test_create_job_template_with_old_machine_cred(run_module, admin_user, proje
|
||||
}
|
||||
|
||||
assert machine_credential.id in [cred.pk for cred in jt.credentials.all()]
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_create_job_template_with_new_credentials(run_module, admin_user, project, inventory, machine_credential):
|
||||
jt = JobTemplate.objects.create(
|
||||
name='foo',
|
||||
playbook='helloworld.yml',
|
||||
inventory=inventory,
|
||||
project=project
|
||||
)
|
||||
result = run_module('tower_job_template', dict(
|
||||
name='foo',
|
||||
playbook='helloworld.yml',
|
||||
project=project.name,
|
||||
credentials=[machine_credential.name]
|
||||
), admin_user)
|
||||
assert result.pop('changed', None), result
|
||||
|
||||
result.pop('invocation')
|
||||
assert result == {
|
||||
"job_template": "foo",
|
||||
"state": "present",
|
||||
"id": jt.id
|
||||
}
|
||||
|
||||
assert [machine_credential.id] == [cred.pk for cred in jt.credentials.all()]
|
||||
|
||||
Reference in New Issue
Block a user