How to use the placebo.pill.FakeHttpResponse function in placebo

To help you get started, we’ve selected a few placebo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cloud-custodian / cloud-custodian / tests / zpill.py View on Github external
def load_response(self, service, operation):
        response_file = self.get_next_file_path(service, operation)
        self._used.add(response_file)
        pill.LOG.debug("load_responses: %s", response_file)
        response_data = json.loads(
            self.archive.read(response_file), object_hook=pill.deserialize
        )
        return (
            pill.FakeHttpResponse(response_data["status_code"]), response_data["data"]
        )
github garnaat / placebo / placebo / pill.py View on Github external
def load_response(self, service, operation):
        LOG.debug('load_response: %s.%s', service, operation)
        (response_file, file_format) = self.get_next_file_path(
            service, operation)
        LOG.debug('load_responses: %s', response_file)
        with open(response_file, Format.read_mode(file_format)) as fp:
            response_data = get_deserializer(file_format)(fp)
        return (FakeHttpResponse(response_data['status_code']),
                response_data['data'])