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

@@ -1904,9 +1904,9 @@ class CredentialTypeSerializer(BaseSerializer):
)
ret = super(CredentialTypeSerializer, self).validate(attrs)
if 'kind' in attrs and attrs['kind'] not in ('cloud', 'network'):
if 'kind' in attrs and attrs['kind'] not in ('cloud', 'net'):
raise serializers.ValidationError({
"kind": _("Must be 'cloud' or 'network', not %s") % attrs['kind']
"kind": _("Must be 'cloud' or 'net', not %s") % attrs['kind']
})
fields = attrs.get('inputs', {}).get('fields', [])