fix a few issues in credential type kind validation

- fix a typo from `network` to `net`
- properly update OPTIONS for CredentialTypes to reflect allowed `kind`
  values for POST/PUT/

see: #6959
This commit is contained in:
Ryan Petrello
2017-07-10 17:52:16 -04:00
parent b79627d57c
commit 09055f9c2f
3 changed files with 35 additions and 3 deletions

View File

@@ -143,6 +143,28 @@ def test_create_managed_by_tower_readonly(get, post, admin):
assert response.data['results'][0]['managed_by_tower'] is False
@pytest.mark.django_db
@pytest.mark.parametrize('kind', ['cloud', 'net'])
def test_create_valid_kind(kind, get, post, admin):
response = post(reverse('api:credential_type_list'), {
'kind': kind,
'name': 'My Custom Type',
'inputs': {
'fields': [{
'id': 'api_token',
'label': 'API Token',
'type': 'string',
'secret': True
}]
},
'injectors': {}
}, admin)
assert response.status_code == 201
response = get(reverse('api:credential_type_list'), admin)
assert response.data['count'] == 1
@pytest.mark.django_db
@pytest.mark.parametrize('kind', ['ssh', 'vault', 'scm', 'insights'])
def test_create_invalid_kind(kind, get, post, admin):