Beispiel #1
0
    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}
Beispiel #2
0
    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}
Beispiel #3
0
    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
Beispiel #4
0
    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'
Beispiel #5
0
    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
Beispiel #6
0
    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'