add test coverage

This commit is contained in:
matt
2023-03-23 15:44:00 -06:00
parent 7c4aedf716
commit b0c416334f
2 changed files with 71 additions and 0 deletions

View File

@@ -132,3 +132,20 @@ def test_secret_field_write_twice(run_module, organization, admin_user, cred_typ
else:
assert result.get('changed') is False, result
assert Credential.objects.get(id=result['id']).get_input('token') == val1
@pytest.mark.django_db
@pytest.mark.parametrize('state', ('present', 'absent', 'exists'))
def test_credential_state(run_module, organization, admin_user, cred_type, state):
for state in ('present', 'absent', 'exists'):
result = run_module(
'credential',
dict(
name='Galaxy Token for Steve',
organization=organization.name,
credential_type=cred_type.name,
inputs={'token': '7rEZK38DJl58A7RxA6EC7lLvUHbBQ1'},
state=state,
),
admin_user,
)
assert not result.get('failed', False), result.get('msg', result)