Ejemplo n.º 1
1
    def test_protobuf_serializer(self):
        serializer = ProtobufSerializer(queueschema)

        headers, content = serializer.dump({}, protobuf)

        assert headers['Content-Type'] == 'application/x-protobuf'
        assert headers['X-Protobuf-FullName'] == protobuf.DESCRIPTOR.full_name
        assert content == protobuf.SerializeToString()
Ejemplo n.º 2
0
    def test_protobuf_serializer(self):
        serializer = ProtobufSerializer(queueschema)

        headers, content = serializer.dump({}, protobuf)

        assert headers['Content-Type'] == 'application/x-protobuf'
        assert headers['X-Protobuf-FullName'] == protobuf.DESCRIPTOR.full_name
        assert content == protobuf.SerializeToString()
Ejemplo n.º 3
0
    def test_protobuf_deserializer(self):
        serializer = ProtobufSerializer(queueschema)

        content = protobuf.SerializeToString()
        response = httplib2.Response({
            'status' : 200,
            'content-type' : 'application/x-protobuf',
            'x-protobuf-fullname' : protobuf.DESCRIPTOR.full_name,
        })

        response, content = serializer.load(response, content)
        assert content.SerializeToString() == protobuf.SerializeToString()
Ejemplo n.º 4
0
    def test_protobuf_deserializer(self):
        serializer = ProtobufSerializer(queueschema)

        content = protobuf.SerializeToString()
        response = httplib2.Response({
            'status':
            200,
            'content-type':
            'application/x-protobuf',
            'x-protobuf-fullname':
            protobuf.DESCRIPTOR.full_name,
        })

        response, content = serializer.load(response, content)
        assert content.SerializeToString() == protobuf.SerializeToString()