コード例 #1
0
ファイル: connection_test.py プロジェクト: mxmn/pylend
    def bad_request_raises_no_exception_test(self, requests_get_patch):

        response = MockResponse('foo', 400, '')
        requests_get_patch.return_value = response
        c = Connection(api_key="testkey")

        c.get("foo")
コード例 #2
0
ファイル: connection_test.py プロジェクト: Webs961/pylend
    def bad_request_raises_no_exception_test(
            self,
            requests_get_patch):

        response = MockResponse('foo', 400, '')
        requests_get_patch.return_value = response
        c = Connection(api_key="testkey")

        c.get("foo")
コード例 #3
0
ファイル: connection_test.py プロジェクト: mxmn/pylend
    def not_found_raises_ExecutionFailureException_test(
            self, requests_get_patch):

        response = Response()
        response.status_code = 404
        requests_get_patch.return_value = response
        c = Connection(api_key="testkey")

        with self.assertRaises(ResourceNotFoundException):
            c.get("foo")
コード例 #4
0
ファイル: connection_test.py プロジェクト: mxmn/pylend
    def server_error_raises_ExecutionFailureException_test(
            self, requests_get_patch):

        response = Response()
        response.status_code = 500
        requests_get_patch.return_value = response
        c = Connection(api_key="testkey")

        with self.assertRaises(ExecutionFailureException):
            c.get("foo")
コード例 #5
0
ファイル: connection_test.py プロジェクト: Webs961/pylend
    def not_found_raises_ExecutionFailureException_test(
            self,
            requests_get_patch):

        response = Response()
        response.status_code = 404
        requests_get_patch.return_value = response
        c = Connection(api_key="testkey")

        with self.assertRaises(ResourceNotFoundException):
            c.get("foo")
コード例 #6
0
ファイル: connection_test.py プロジェクト: Webs961/pylend
    def server_error_raises_ExecutionFailureException_test(
            self,
            requests_get_patch):

        response = Response()
        response.status_code = 500
        requests_get_patch.return_value = response
        c = Connection(api_key="testkey")

        with self.assertRaises(ExecutionFailureException):
            c.get("foo")
コード例 #7
0
ファイル: connection_test.py プロジェクト: mxmn/pylend
    def bad_authentication_raises_AuthorizationException_test(
            self, requests_get_patch):
        response = Response()
        response.status_code = 401
        requests_get_patch.return_value = response
        c = Connection(api_key="testkey")

        with self.assertRaises(AuthorizationException):
            c.get("foo")

        response = Response()
        response.status_code = 403
        requests_get_patch.return_value = response
        c = Connection(api_key="testkey")

        with self.assertRaises(AuthorizationException):
            c.get("foo")
コード例 #8
0
ファイル: connection_test.py プロジェクト: Webs961/pylend
    def bad_authentication_raises_AuthorizationException_test(
            self,
            requests_get_patch):
        response = Response()
        response.status_code = 401
        requests_get_patch.return_value = response
        c = Connection(api_key="testkey")

        with self.assertRaises(AuthorizationException):
            c.get("foo")

        response = Response()
        response.status_code = 403
        requests_get_patch.return_value = response
        c = Connection(api_key="testkey")

        with self.assertRaises(AuthorizationException):
            c.get("foo")