mirror of
https://github.com/ansible/awx.git
synced 2026-05-17 14:27:42 -02:30
Modernize types of WFJT module
This commit is contained in:
35
awx_collection/test/awx/test_workflow_template.py
Normal file
35
awx_collection/test/awx/test_workflow_template.py
Normal file
@@ -0,0 +1,35 @@
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import pytest
|
||||
|
||||
from awx.main.models import WorkflowJobTemplate
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_create_workflow_job_template(run_module, admin_user, organization):
|
||||
|
||||
module_args = {
|
||||
'name': 'foo-workflow',
|
||||
'organization': organization.name,
|
||||
'extra_vars': {'foo': 'bar', 'another-foo': {'barz': 'bar2'}},
|
||||
'state': 'present'
|
||||
}
|
||||
|
||||
result = run_module('tower_workflow_template', module_args, admin_user)
|
||||
|
||||
wfjt = WorkflowJobTemplate.objects.get(name='foo-workflow')
|
||||
assert wfjt.extra_vars == '{"foo": "bar", "another-foo": {"barz": "bar2"}}'
|
||||
|
||||
result.pop('module_args', None)
|
||||
assert result == {
|
||||
"workflow_template": "foo-workflow", # TODO: remove after refactor
|
||||
"state": "present",
|
||||
"id": wfjt.id,
|
||||
"changed": True,
|
||||
"invocation": {
|
||||
"module_args": module_args
|
||||
}
|
||||
}
|
||||
|
||||
assert wfjt.organization_id == organization.id
|
||||
Reference in New Issue
Block a user