def test_no_validation_error(self, api): '''Should pass if no validation error''' response = api.put(url_for('api.fake'), { 'required': 'value', 'email': '*****@*****.**', 'choices': 'first', }) assert200(response) assert response.json == {'success': True}
def test_no_validation_error(self, api): '''Should pass if no validation error''' response = api.put(url_for('api.fake'), { 'required': 'value', 'email': '*****@*****.**', 'choices': 'first', }) assert200(response) assert response.json == {'success': True}
def test_validation_errors(self, api): '''Should raise a HTTP 400 and returns errors on validation error''' response = api.put(url_for('api.fake'), {'email': 'wrong'}) assert400(response) assert response.content_type == 'application/json' for field in 'required', 'email', 'choices': assert field in response.json['errors'] assert isinstance(response.json['errors'][field], list)
def test_validation_errors(self, api): '''Should raise a HTTP 400 and returns errors on validation error''' response = api.put(url_for('api.fake'), {'email': 'wrong'}) assert400(response) assert response.content_type == 'application/json' for field in 'required', 'email', 'choices': assert field in response.json['errors'] assert isinstance(response.json['errors'][field], list)