def given_a_mock_server_on_the_other_end_of_the_transport(self): self.dispatcher = asynqp.routing.Dispatcher() self.protocol = protocol.AMQP(self.dispatcher, self.loop) self.server = MockServer(self.protocol, self.tick) self.transport = FakeTransport(self.server) self.protocol.connection_made(self.transport)
def given_a_connected_protocol(self): self.transport = mock.Mock(spec=asyncio.Transport) self.dispatcher = mock.Mock(spec=asynqp.routing.Dispatcher) self.protocol = protocol.AMQP(self.dispatcher, self.loop) self.protocol.connection_made(self.transport)