Esempio n. 1
0
    def test_close_with_callback(self):
        # with close callback
        cbmock = Mock()
        ch = BaseChannel(close_callback=cbmock)
        ch._fsm.current_state = ch.S_ACTIVE
        ch.close()

        cbmock.assert_called_once_with(ch)
Esempio n. 2
0
    def test_close_with_callback(self):
        # with close callback
        cbmock = Mock()
        ch = BaseChannel(close_callback=cbmock)
        ch._fsm.current_state = ch.S_ACTIVE
        ch.close()

        cbmock.assert_called_once_with(ch)
Esempio n. 3
0
    def test_close(self):

        # without close callback
        transport = Mock()
        ch = BaseChannel()
        ch.on_channel_open(transport)
        ch._fsm.current_state = ch.S_ACTIVE
        
        ch.close()
        transport.close.assert_called_once_with()
Esempio n. 4
0
    def test_close(self):

        # without close callback
        transport = Mock()
        ch = BaseChannel()
        ch.on_channel_open(transport)
        ch._fsm.current_state = ch.S_ACTIVE

        ch.close()
        transport.close.assert_called_once_with()
Esempio n. 5
0
    def test_close(self):

        # without close callback
        ac = Mock() #pchannel.Channel)  # cannot use this because callbacks is populated dynamically
        ch = BaseChannel()
        ch._amq_chan = ac
        ch._fsm.current_state = ch.S_ACTIVE
        
        ch.close()
        ac.close.assert_called_once_with()
        self.assertEquals(ac.callbacks.remove.call_count, 4)
Esempio n. 6
0
    def test_close(self):

        # without close callback
        ac = Mock(
        )  #pchannel.Channel)  # cannot use this because callbacks is populated dynamically
        ch = BaseChannel()
        ch._amq_chan = ac
        ch._fsm.current_state = ch.S_ACTIVE

        ch.close()
        ac.close.assert_called_once_with()
        self.assertEquals(ac.callbacks.remove.call_count, 4)
Esempio n. 7
0
    def test_close(self):
        # with close callback
        cbmock = Mock()
        ch = BaseChannel(close_callback=cbmock)
        ch.close()

        cbmock.assert_called_once_with(ch)

        # without close callback
        ac = Mock() #pchannel.Channel)  # cannot use this because callbacks is populated dynamically
        ch = BaseChannel()
        ch._amq_chan = ac
        
        ch.close()
        ac.close.assert_called_once_with()
        self.assertEquals(ac.callbacks.remove.call_count, 4)