Merge pull request #2443 from cchurch/credential_create_fixes

Update validation and supported fields for creating credentials.
This commit is contained in:
Chris Church
2016-06-17 12:05:53 -04:00
committed by GitHub
5 changed files with 82 additions and 87 deletions

View File

@@ -216,13 +216,16 @@ def test_openstack_create_fail_required_fields(post, organization, admin):
#
@pytest.mark.django_db
def test_create_credential_xfails(post, organization, team, admin):
def test_create_credential_missing_user_team_org_xfail(post, admin):
# Must specify one of user, team, or organization
response = post(reverse('api:credential_list'), {
'name': 'Some name',
'username': 'someusername',
}, admin)
assert response.status_code == 400
@pytest.mark.django_db
def test_create_credential_with_user_and_org_xfail(post, organization, admin):
# Can only specify one of user, team, or organization
response = post(reverse('api:credential_list'), {
'name': 'Some name',
@@ -231,6 +234,9 @@ def test_create_credential_xfails(post, organization, team, admin):
'organization': organization.id,
}, admin)
assert response.status_code == 400
@pytest.mark.django_db
def test_create_credential_with_team_and_org_xfail(post, organization, team, admin):
response = post(reverse('api:credential_list'), {
'name': 'Some name',
'username': 'someusername',
@@ -238,6 +244,9 @@ def test_create_credential_xfails(post, organization, team, admin):
'team': team.id,
}, admin)
assert response.status_code == 400
@pytest.mark.django_db
def test_create_credential_with_user_and_team_xfail(post, team, admin):
response = post(reverse('api:credential_list'), {
'name': 'Some name',
'username': 'someusername',
@@ -245,7 +254,3 @@ def test_create_credential_xfails(post, organization, team, admin):
'team': team.id,
}, admin)
assert response.status_code == 400