How to use the placebo.serializer.get_deserializer 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 garnaat / placebo / tests / unit / test_serializers.py View on Github external
def test_roundtrip_json(self):
        ser = get_serializer(Format.JSON)
        deser = get_deserializer(Format.JSON)
        fp = StringIO()
        ser(date_sample, fp)
        fp.seek(0)
        obj = deser(fp)
        self.assertEqual(obj, date_sample)
github garnaat / placebo / tests / unit / test_serializers.py View on Github external
def test_get_deserialize_pickle(self):
        ser = get_deserializer(Format.PICKLE)
        self.assertEqual(ser, _deserialize_pickle)
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'])