def test_constructor(self): s = virtual.BrokerState() self.assertTrue(hasattr(s, 'exchanges')) self.assertTrue(hasattr(s, 'bindings')) t = virtual.BrokerState(exchanges=16, bindings=32) self.assertEqual(t.exchanges, 16) self.assertEqual(t.bindings, 32)
class Transport(virtual.Transport): """Google Cloud Pub/Sub Transport.""" Channel = Channel state = virtual.BrokerState() implements = virtual.Transport.implements.extend( async=False, exchange_type=frozenset(['direct', 'topic']), heartbeats=False, ) driver_type = 'gps' driver_name = 'gps' def driver_version(self): return '0.1' # In order to support async, these two methods need to be implemented here. def register_with_event_loop(self, connection, loop): return super(Transport, self).register_with_event_loop(connection, loop) def on_readable(self, connection, loop): return super(Transport, self).on_readable(connection, loop)
def test_BrokerState(): s = virtual.BrokerState() assert hasattr(s, 'exchanges') t = virtual.BrokerState(exchanges=16) assert t.exchanges == 16
class Transport(virtual.Transport): Channel = Channel #: memory backend state is global. state = virtual.BrokerState()