Fix copy_from warning message

- warn() does not take keyword 'msg'
- add testing around the copy_from parameter for project creation
This commit is contained in:
Seth Foster
2021-06-26 01:28:02 -04:00
parent 2afa406b7f
commit 5da02690c1
2 changed files with 24 additions and 1 deletions

View File

@@ -24,3 +24,26 @@ def test_create_project(run_module, admin_user, organization, silence_warning):
result.pop('invocation')
assert result == {'name': 'foo', 'id': proj.id}
@pytest.mark.django_db
def test_create_project_copy_from(run_module, admin_user, organization, silence_warning):
''' Test the copy_from functionality'''
result = run_module(
'project',
dict(name='foo', organization=organization.name, scm_type='git', scm_url='https://foo.invalid', wait=False, scm_update_cache_timeout=5),
admin_user,
)
assert result.pop('changed', None), result
proj_name = 'bar'
result = run_module(
'project',
dict(name=proj_name, copy_from='foo', scm_type='git', wait=False),
admin_user,
)
assert result.pop('changed', None), result
result = run_module(
'project',
dict(name=proj_name, copy_from='foo', scm_type='git', wait=False),
admin_user,
)
silence_warning.assert_called_with(f"A project with the name {proj_name} already exists.")