From f8b64f222298d19a5dd35111a97a320fc0e092a6 Mon Sep 17 00:00:00 2001 From: AlanCoding Date: Wed, 30 Oct 2019 15:40:49 -0400 Subject: [PATCH] Fix and test for warning when creating project --- .../plugins/modules/tower_project.py | 2 +- awx_collection/test/awx/test_project.py | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 awx_collection/test/awx/test_project.py diff --git a/awx_collection/plugins/modules/tower_project.py b/awx_collection/plugins/modules/tower_project.py index ce18b3ae71..5c5f90faaa 100644 --- a/awx_collection/plugins/modules/tower_project.py +++ b/awx_collection/plugins/modules/tower_project.py @@ -145,7 +145,7 @@ def main(): scm_clean=dict(type='bool', default=False), scm_delete_on_update=dict(type='bool', default=False), scm_update_on_launch=dict(type='bool', default=False), - scm_update_cache_timeout=dict(type='int', default=0), + scm_update_cache_timeout=dict(type='int'), job_timeout=dict(type='int', default=0), custom_virtualenv=dict(), local_path=dict(), diff --git a/awx_collection/test/awx/test_project.py b/awx_collection/test/awx/test_project.py new file mode 100644 index 0000000000..ad8adb867f --- /dev/null +++ b/awx_collection/test/awx/test_project.py @@ -0,0 +1,25 @@ +import pytest + +from awx.main.models import Project + + +@pytest.mark.django_db +def test_create_project(run_module, admin_user, organization): + result = run_module('tower_project', dict( + name='foo', + organization=organization.name, + scm_type='git', + scm_url='https://foo.invalid' + ), admin_user) + assert result.pop('changed', None), result + + proj = Project.objects.get(name='foo') + assert proj.scm_url == 'https://foo.invalid' + assert proj.organization == organization + + result.pop('invocation') + assert result == { + 'id': proj.id, + 'project': 'foo', + 'state': 'present' + }