Ejemplo n.º 1
0
    def test_closed_cb_without_final_frame(self):
        c = Channel('connection', None, {
            20: ChannelClass,
            40: ExchangeClass,
            50: QueueClass,
            60: BasicClass,
            90: TransactionClass,
        })
        c._pending_events = 'foo'
        c._frame_buffer = 'foo'

        for val in c._class_map.values():
            expect(val._cleanup)
        expect(c._notify_close_listeners)

        c._closed_cb()
        assert_equals(deque([]), c._pending_events)
        assert_equals(deque([]), c._frame_buffer)
        assert_equals(None, c._connection)
        assert_false(hasattr(c, 'channel'))
        assert_false(hasattr(c, 'exchange'))
        assert_false(hasattr(c, 'queue'))
        assert_false(hasattr(c, 'basic'))
        assert_false(hasattr(c, 'tx'))
        assert_equals(None, c._class_map)
        assert_equals(set(), c._close_listeners)
Ejemplo n.º 2
0
    def test_closed_cb_without_final_frame(self):
        c = Channel(
            'connection', None, {
                20: ChannelClass,
                40: ExchangeClass,
                50: QueueClass,
                60: BasicClass,
                90: TransactionClass,
            })
        c._pending_events = 'foo'
        c._frame_buffer = 'foo'

        for val in c._class_map.values():
            expect(val._cleanup)
        expect(c._notify_close_listeners)

        c._closed_cb()
        assert_equals(deque([]), c._pending_events)
        assert_equals(deque([]), c._frame_buffer)
        assert_equals(None, c._connection)
        assert_false(hasattr(c, 'channel'))
        assert_false(hasattr(c, 'exchange'))
        assert_false(hasattr(c, 'queue'))
        assert_false(hasattr(c, 'basic'))
        assert_false(hasattr(c, 'tx'))
        assert_equals(None, c._class_map)
        assert_equals(set(), c._close_listeners)
Ejemplo n.º 3
0
    def test_closed_cb_with_final_frame(self):
        conn = mock()
        c = Channel(conn, None, {})

        expect(conn.send_frame).args('final')
        for val in c._class_map.values():
            expect(val._cleanup)

        c._closed_cb('final')
Ejemplo n.º 4
0
    def test_closed_cb_with_final_frame(self):
        conn = mock()
        c = Channel(conn, None, {})

        expect(conn.send_frame).args('final')
        for val in c._class_map.values():
            expect(val._cleanup)

        c._closed_cb('final')
Ejemplo n.º 5
0
    def test_closed_cb_without_final_frame(self):
        c = Channel(mock(), None, self._CLASS_MAP)
        c._pending_events = 'foo'
        c._frame_buffer = 'foo'

        for val in c._class_map.values():
            expect(val._cleanup)
        expect(c._notify_close_listeners)

        c._closed_cb()
        assert_equals(deque([]), c._pending_events)
        assert_equals(deque([]), c._frame_buffer)
        assert_equals(None, c._connection)
        assert_false(hasattr(c, 'channel'))
        assert_false(hasattr(c, 'exchange'))
        assert_false(hasattr(c, 'queue'))
        assert_false(hasattr(c, 'basic'))
        assert_false(hasattr(c, 'tx'))
        assert_equals(None, c._class_map)
        assert_equals(set(), c._close_listeners)
Ejemplo n.º 6
0
    def test_closed_cb_without_final_frame(self):
        c = Channel(mock(), None, self._CLASS_MAP)
        c._pending_events = 'foo'
        c._frame_buffer = 'foo'

        for val in c._class_map.values():
            expect(val._cleanup)
        expect(c._notify_close_listeners)

        c._closed_cb()
        assert_equals(deque([]), c._pending_events)
        assert_equals(deque([]), c._frame_buffer)
        assert_equals(None, c._connection)
        assert_false(hasattr(c, 'channel'))
        assert_false(hasattr(c, 'exchange'))
        assert_false(hasattr(c, 'queue'))
        assert_false(hasattr(c, 'basic'))
        assert_false(hasattr(c, 'tx'))
        assert_equals(None, c._class_map)
        assert_equals(set(), c._close_listeners)
Ejemplo n.º 7
0
    def test_closed_cb_without_final_frame(self):
        c = Channel(
            "connection",
            None,
            {20: ChannelClass, 40: ExchangeClass, 50: QueueClass, 60: BasicClass, 90: TransactionClass},
        )
        c._pending_events = "foo"
        c._frame_buffer = "foo"

        for val in c._class_map.values():
            expect(val._cleanup)
        expect(c._notify_close_listeners)

        c._closed_cb()
        assert_equals(deque([]), c._pending_events)
        assert_equals(deque([]), c._frame_buffer)
        assert_equals(None, c._connection)
        assert_false(hasattr(c, "channel"))
        assert_false(hasattr(c, "exchange"))
        assert_false(hasattr(c, "queue"))
        assert_false(hasattr(c, "basic"))
        assert_false(hasattr(c, "tx"))
        assert_equals(None, c._class_map)
        assert_equals(set(), c._close_listeners)