hit the is_valid method before stripping the special fields in credential view

This commit is contained in:
AlanCoding
2016-05-05 14:20:36 -04:00
parent 097c450581
commit b1dfa28459
2 changed files with 15 additions and 0 deletions

View File

@@ -21,6 +21,16 @@ def test_create_user_credential_via_credentials_list(post, get, alice):
assert response.status_code == 200
assert response.data['count'] == 1
@pytest.mark.django_db
def test_credential_validation_error_with_bad_user(post, alice):
response = post(reverse('api:credential_list'), {
'user': 'asdf',
'name': 'Some name',
'username': 'someusername'
}, alice)
assert response.status_code == 403
assert response.data['detail'] == 'You do not have permission to perform this action.'
@pytest.mark.django_db
def test_create_user_credential_via_user_credentials_list(post, get, alice):
response = post(reverse('api:user_credentials_list', args=(alice.pk,)), {