mirror of
https://github.com/ZwareBear/awx.git
synced 2026-04-14 03:51:49 -05:00
Disallow changing credential_type of an existing credential
This commit is contained in:
@@ -1446,6 +1446,34 @@ def test_field_removal(put, organization, admin, credentialtype_ssh, version, pa
|
||||
assert 'password' not in cred.inputs
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_credential_type_immutable_in_v2(patch, organization, admin, credentialtype_ssh, credentialtype_aws):
|
||||
cred = Credential(
|
||||
credential_type=credentialtype_ssh,
|
||||
name='Best credential ever',
|
||||
organization=organization,
|
||||
inputs={
|
||||
'username': u'jim',
|
||||
'password': u'pass'
|
||||
}
|
||||
)
|
||||
cred.save()
|
||||
|
||||
response = patch(
|
||||
reverse('api:credential_detail', kwargs={'version': 'v2', 'pk': cred.pk}),
|
||||
{
|
||||
'credential_type': credentialtype_aws.pk,
|
||||
'inputs': {
|
||||
'username': u'jim',
|
||||
'password': u'pass'
|
||||
}
|
||||
},
|
||||
admin
|
||||
)
|
||||
assert response.status_code == 400
|
||||
assert 'credential_type' in response.data
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
@pytest.mark.parametrize('version, params', [
|
||||
['v1', {
|
||||
|
||||
Reference in New Issue
Block a user