示例#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)
示例#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)
示例#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()
示例#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()
示例#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)
示例#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)
示例#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)