More accurate test to check validation of bad data

This commit is contained in:
AlanCoding
2016-05-10 09:35:13 -04:00
parent 3d26506c8e
commit f9c177edd5
2 changed files with 4 additions and 10 deletions

View File

@@ -22,14 +22,14 @@ def test_create_user_credential_via_credentials_list(post, get, alice):
assert response.data['count'] == 1
@pytest.mark.django_db
def test_credential_validation_error_with_bad_user(post, alice):
def test_credential_validation_error_with_bad_user(post, admin):
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.'
}, 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):