Merge pull request #1801 from AlanCoding/1773_cred_detail_serializer

Purge credential detail view of special fields
This commit is contained in:
Alan Rominger
2016-05-18 09:54:43 -04:00
3 changed files with 46 additions and 21 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, admin):
response = post(reverse('api:credential_list'), {
'user': 'asdf',
'name': 'Some name',
'username': 'someusername'
}, admin)
assert response.status_code == 400
assert response.data['user'][0] == 'Incorrect type. Expected pk value, received unicode.'
@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,)), {