Esempio n. 1
0
    def test_connection_cleanup_channel_does_not_exist(self):
        connection = Connection('127.0.0.1', 'guest', 'guest', lazy=True)
        connection._channels[1] = Channel(1, connection, 0.1)

        connection._cleanup_channel(2)

        self.assertEqual(len(connection._channels), 1)
Esempio n. 2
0
    def test_connection_cleanup_one_channel(self):
        connection = Connection('127.0.0.1', 'guest', 'guest', lazy=True)
        connection._channels[1] = Channel(1, connection, 0.1)

        connection._cleanup_channel(1)

        self.assertFalse(connection._channels)
Esempio n. 3
0
    def test_connection_cleanup_multiple_channels(self):
        connection = Connection('127.0.0.1', 'guest', 'guest', lazy=True)

        for index in range(1, 10):
            connection._channels[index] = Channel(index, connection, 0.1)

        for index in range(1, 10):
            connection._cleanup_channel(index)

        self.assertFalse(connection._channels)