Add new option update_secrets to allow lazy or strict updating

This commit is contained in:
Alan Rominger
2020-09-04 11:48:56 -04:00
parent 8e97214309
commit 362d6a3204
7 changed files with 56 additions and 19 deletions

View File

@@ -154,7 +154,8 @@ def test_make_use_of_custom_credential_type(run_module, organization, admin_user
@pytest.mark.django_db
def test_secret_field_write_twice(run_module, organization, admin_user, cred_type):
@pytest.mark.parametrize('update_secrets', [True, False])
def test_secret_field_write_twice(run_module, organization, admin_user, cred_type, update_secrets):
val1 = '7rEZK38DJl58A7RxA6EC7lLvUHbBQ1'
result = run_module('tower_credential', dict(
name='Galaxy Token for Steve',
@@ -172,9 +173,14 @@ def test_secret_field_write_twice(run_module, organization, admin_user, cred_typ
name='Galaxy Token for Steve',
organization=organization.name,
credential_type=cred_type.name,
inputs={'token': val2}
inputs={'token': val2},
update_secrets=update_secrets
), admin_user)
assert not result.get('failed', False), result.get('msg', result)
Credential.objects.get(id=result['id']).inputs['token'] == val2
assert result.get('changed'), result
print(result)
if update_secrets:
assert result.get('changed'), result
else:
assert result.get('changed') is False, result