Exemplo n.º 1
0
 def test_returns_serializable(self, configuration):
     """
     The storage server attached to the result of
     ``storage_server.get_storage_server`` can be serialized by a banana
     Broker (for Foolscap).
     """
     storage_server_deferred = storage_server.get_storage_server(
         configuration,
         get_anonymous_storage_server,
     )
     broker = Broker(None)
     broker.makeConnection(StringTransport())
     self.expectThat(
         storage_server_deferred,
         succeeded(
             AfterPreprocessing(
                 lambda ann: broker.send(ann.storage_server),
                 Always(),
             ), ),
     )
Exemplo n.º 2
0
    def test_returns_hashable(self, configuration):
        """
        The storage server attached to the result of
        ``storage_server.get_storage_server`` is hashable for use as a Python
        dictionary key.

        This is another requirement of Foolscap.
        """
        storage_server_deferred = storage_server.get_storage_server(
            configuration,
            get_anonymous_storage_server,
        )
        broker = Broker(None)
        broker.makeConnection(StringTransport())
        self.expectThat(
            storage_server_deferred,
            succeeded(
                AfterPreprocessing(
                    lambda ann: hash(ann.storage_server),
                    Always(),
                ), ),
        )
Exemplo n.º 3
0
 def sendPONG(self, number):
     self.pongs += 1
     log.msg("PONG: %d" % number)
     Broker.sendPONG(self, number)
Exemplo n.º 4
0
 def sendPING(self, number=0):
     self.pings += 1
     log.msg("PING: %d" % number)
     Broker.sendPING(self, number)
Exemplo n.º 5
0
 def sendPONG(self, number):
     self.pongs += 1
     log.msg("PONG: %d" % number)
     Broker.sendPONG(self, number)
Exemplo n.º 6
0
 def sendPING(self, number=0):
     self.pings += 1
     log.msg("PING: %d" % number)
     Broker.sendPING(self, number)