예제 #1
0
    def test_missing_serializer(self):
        from pyramid_caching.serializers import SerializationError
        utility = SerializerUtility(self.config.registry)

        class UnknownType:
            pass

        with self.assertRaises(SerializationError):
            utility.dumps(UnknownType())
예제 #2
0
    def test_missing_serializer(self):
        from pyramid_caching.serializers import SerializationError
        utility = SerializerUtility(self.config.registry)

        class UnknownType:
            pass

        with self.assertRaises(SerializationError):
            utility.dumps(UnknownType())
예제 #3
0
 def test_query_serializer(self):
     utility = SerializerUtility(self.config.registry)
     utility.register_serialization_adapter(str, DummyAdapter)
     data = utility.dumps("object")
     data = pickle.loads(data)
     self.assertEqual(data['payload'], "OBJECT")
예제 #4
0
 def test_encode_payload(self):
     utility = SerializerUtility(DummyRegistry())
     data = utility.dumps("object", adapter=DummyAdapter())
     data = pickle.loads(data)
     self.assertEqual(data['payload'], "OBJECT")
예제 #5
0
 def test_encode_meta_format_version(self):
     utility = SerializerUtility(DummyRegistry())
     data = utility.dumps("object", adapter=DummyAdapter())
     data = pickle.loads(data)
     self.assertEqual(data['version'], SERIALIZER_META_VERSION)
예제 #6
0
 def test_encode_serializer_type(self):
     utility = SerializerUtility(DummyRegistry())
     data = utility.dumps("object", adapter=DummyAdapter())
     data = pickle.loads(data)
     self.assertEqual(data['type'], "dummy")
예제 #7
0
 def test_query_serializer(self):
     utility = SerializerUtility(self.config.registry)
     utility.register_serialization_adapter(str, DummyAdapter)
     data = utility.dumps("object")
     data = pickle.loads(data)
     self.assertEqual(data['payload'], "OBJECT")
예제 #8
0
 def test_encode_payload(self):
     utility = SerializerUtility(DummyRegistry())
     data = utility.dumps("object", adapter=DummyAdapter())
     data = pickle.loads(data)
     self.assertEqual(data['payload'], "OBJECT")
예제 #9
0
 def test_encode_meta_format_version(self):
     utility = SerializerUtility(DummyRegistry())
     data = utility.dumps("object", adapter=DummyAdapter())
     data = pickle.loads(data)
     self.assertEqual(data['version'], SERIALIZER_META_VERSION)
예제 #10
0
 def test_encode_serializer_type(self):
     utility = SerializerUtility(DummyRegistry())
     data = utility.dumps("object", adapter=DummyAdapter())
     data = pickle.loads(data)
     self.assertEqual(data['type'], "dummy")