Exemple #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)
Exemple #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)
Exemple #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()
    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()
Exemple #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)
Exemple #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)
Exemple #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)