remove default key_type

This commit is contained in:
Leo Hemsted
2016-06-27 16:55:51 +01:00
parent fe80d785f9
commit 4c44f0c9e9
2 changed files with 6 additions and 4 deletions

View File

@@ -40,7 +40,7 @@ def test_api_key_should_return_error_when_service_does_not_exist(notify_api, sam
assert response.status_code == 404
def test_create_api_key_should_set_default_key_type_of_normal(notify_api, sample_service):
def test_create_api_key_without_key_type_rejects(notify_api, sample_service):
with notify_api.test_request_context(), notify_api.test_client() as client:
data = {
'name': 'some secret name',
@@ -50,8 +50,10 @@ def test_create_api_key_should_set_default_key_type_of_normal(notify_api, sample
response = client.post(url_for('service.create_api_key', service_id=sample_service.id),
data=json.dumps(data),
headers=[('Content-Type', 'application/json'), auth_header])
assert response.status_code == 201
assert ApiKey.query.one().key_type == KEY_TYPE_NORMAL
assert response.status_code == 400
json_resp = json.loads(response.get_data(as_text=True))
assert json_resp['result'] == 'error'
assert json_resp['message'] == {'key_type': ['Missing data for required field.']}
def test_revoke_should_expire_api_key_for_service(notify_api, sample_api_key):