Пример #1
0
 def test_get_body_deserializer_unknown_content_type(self):
     """Verify that exception InvalidContentType is raised."""
     content_type = 'application/unknown'
     deserializer = wsgi.RequestDeserializer()
     self.assertRaises(
         exception.InvalidContentType,
         deserializer.get_body_deserializer, content_type)
Пример #2
0
    def setUp(self):
        super(RequestDeserializerTest, self).setUp()

        class JSONDeserializer(object):
            def deserialize(self, data, action='default'):
                return 'pew_json'

        self.body_deserializers = {'application/json': JSONDeserializer()}

        self.deserializer = wsgi.RequestDeserializer(self.body_deserializers)