コード例 #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}
コード例 #2
0
ファイル: test_auth_api.py プロジェクト: opendatateam/udata
    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}
コード例 #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
コード例 #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'
コード例 #5
0
ファイル: test_auth_api.py プロジェクト: opendatateam/udata
    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
コード例 #6
0
ファイル: test_auth_api.py プロジェクト: opendatateam/udata
    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'