Example #1
0
    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}
Example #2
0
    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}
Example #3
0
    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)
Example #4
0
    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)