예제 #1
0
    def get_https_response(self, api_path, mode=None):
        if mode is None:
            mode = self.__https_response_mode

        try:
            response = self.HTTPS_MOCK_RESPONSES[mode][api_path]
        except KeyError:
            try:
                response = self.__COMMON_HTTPS_MOCK_RESPONSES[mode][api_path]
            except KeyError:
                raise test.TestingException(
                    'Mock API Endpoint not implemented: [{}]{}'.format(
                        self.__RESPONSE_MODE_NAMES[mode], api_path))

        if not isinstance(response, mocks.MockHTTPSResponse):
            return mocks.MockHTTPSResponse(response, 200)
        return response
예제 #2
0
def bad_function_exception():
    raise test.TestingException()
예제 #3
0
 def rpc(handle, url_params, data, allow_empty_response=True):
     raise test.TestingException("Some exception")
예제 #4
0
 def sut():
     with image_utils.temporary_file():
         raise test.TestingException()