Add field numbering specification in module_util file, update unit tests

This commit is contained in:
beeankha
2020-04-30 13:54:39 -04:00
committed by AlanCoding
parent 31a11cf6bb
commit 6a9423626c
4 changed files with 13 additions and 11 deletions

View File

@@ -4,6 +4,7 @@ __metaclass__ = type
import pytest
from awx.main.models import ActivityStream, JobTemplate, Job, NotificationTemplate
from unittest import mock
@pytest.mark.django_db
@@ -161,10 +162,9 @@ def test_job_template_with_survey_encrypted_default(run_module, admin_user, proj
assert result.get('changed', False), result # not actually desired, but assert for sanity
silence_warning.assert_called_once_with(
"The field survey_spec of job_template {0} has encrypted data and "
"may inaccurately report task is changed.".format(result['id'])
)
silence_warning.assert_has_calls(
[mock.call("The field survey_spec of job_template {0} has encrypted data and "
"may inaccurately report task is changed.".format(result['id']))])
@pytest.mark.django_db

View File

@@ -19,7 +19,10 @@ def test_create_project(run_module, admin_user, organization):
wait=False,
scm_update_cache_timeout=5
), admin_user)
mock_warn.assert_called_once_with('scm_update_cache_timeout will be ignored since scm_update_on_launch was not set to true')
mock_warn.assert_has_calls(
[mock.call('scm_update_cache_timeout will be ignored since scm_update_on_launch '
'was not set to true')])
assert result.pop('changed', None), result
proj = Project.objects.get(name='foo')

View File

@@ -41,7 +41,6 @@ def test_password_no_op_warning(run_module, admin_user, mock_auth_stuff, silence
assert result.get('changed') # not actually desired, but assert for sanity
silence_warning.assert_called_once_with(
"The field password of user {0} has encrypted data and "
"may inaccurately report task is changed.".format(result['id'])
)
silence_warning.assert_has_calls(
[mock.call("The field password of user {0} has encrypted data and "
"may inaccurately report task is changed.".format(result['id']))])