Example #1
0
    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")
Example #2
0
    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")
Example #3
0
    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")
Example #4
0
    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")
Example #5
0
    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")
Example #6
0
    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")
Example #7
0
    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")
Example #8
0
    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")