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(), ), ), )
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(), ), ), )
def sendPONG(self, number): self.pongs += 1 log.msg("PONG: %d" % number) Broker.sendPONG(self, number)
def sendPING(self, number=0): self.pings += 1 log.msg("PING: %d" % number) Broker.sendPING(self, number)