def test_no_auth(self, api): '''Should not return a content type if there is no content on delete''' response = api.get(url_for('api.fake')) assert200(response) assert response.content_type == 'application/json' assert response.json == {'success': True}
def test_permission_denied(self, api): @ns.route('/exception', endpoint='exception') class ExceptionAPI(API): def get(self): raise PermissionDenied('Permission denied') response = api.get(url_for('api.exception')) assert403(response) assert 'message' in response.json
def test_value_error(self, api): @ns.route('/exception', endpoint='exception') class ExceptionAPI(API): def get(self): raise ValueError('Not working') response = api.get(url_for('api.exception')) assert400(response) assert response.json['message'] == 'Not working'