def test_revive(self): exchange = Exchange('foo', 'direct') conn = get_conn() chan = conn.channel() # reviving unbound channel is a noop. exchange.revive(chan) assert not exchange.is_bound assert exchange._channel is None bound = exchange.bind(chan) assert bound.is_bound assert bound.channel is chan chan2 = conn.channel() bound.revive(chan2) assert bound.is_bound assert bound._channel is chan2
def test_revive(self): exchange = Exchange('foo', 'direct') conn = get_conn() chan = conn.channel() # reviving unbound channel is a noop. exchange.revive(chan) self.assertFalse(exchange.is_bound) self.assertIsNone(exchange._channel) bound = exchange.bind(chan) self.assertTrue(bound.is_bound) self.assertIs(bound.channel, chan) chan2 = conn.channel() bound.revive(chan2) self.assertTrue(bound.is_bound) self.assertIs(bound._channel, chan2)