Exemplo n.º 1
0
    def test_send(self, mocksendchannel):
        depmock = Mock()
        pubchan = PublisherChannel()
        pubchan._declare_exchange = depmock

        pubchan._send_name = NameTrio(sentinel.xp, sentinel.routing_key)

        pubchan.send(sentinel.data)

        depmock.assert_called_once_with(sentinel.xp)
        mocksendchannel.send.assert_called_once_with(pubchan, sentinel.data, headers=None)
Exemplo n.º 2
0
    def test_send(self, mocksendchannel):
        depmock = Mock()
        pubchan = PublisherChannel()
        pubchan._declare_exchange = depmock

        pubchan._send_name = NameTrio(sentinel.xp, sentinel.routing_key)

        pubchan.send(sentinel.data)

        depmock.assert_called_once_with(sentinel.xp)
        mocksendchannel.send.assert_called_once_with(pubchan,
                                                     sentinel.data,
                                                     headers=None)
Exemplo n.º 3
0
    def test_send(self, mocksendchannel):
        depmock = Mock()
        pubchan = PublisherChannel()
        pubchan._declare_exchange = depmock

        pubchan._send_name = NameTrio(sentinel.xp, sentinel.routing_key)

        pubchan.send(sentinel.data)

        depmock.assert_called_once_with(sentinel.xp)
        mocksendchannel.send.assert_called_once_with(pubchan, sentinel.data, headers=None)
        self.assertTrue(pubchan._declared)

        # call send again, to show declare is not called again
        pubchan.send(sentinel.data2)
        depmock.assert_called_once_with(sentinel.xp)
        self.assertEquals(mocksendchannel.send.call_count, 2)
        mocksendchannel.send.assert_called_with(pubchan, sentinel.data2, headers=None)
Exemplo n.º 4
0
    def test_send(self, mocksendchannel):
        depmock = Mock()
        pubchan = PublisherChannel()
        pubchan._declare_exchange = depmock

        pubchan._send_name = NameTrio(sentinel.xp, sentinel.routing_key)

        pubchan.send(sentinel.data)

        depmock.assert_called_once_with(sentinel.xp)
        mocksendchannel.send.assert_called_once_with(pubchan,
                                                     sentinel.data,
                                                     headers=None)
        self.assertTrue(pubchan._declared)

        # call send again, to show declare is not called again
        pubchan.send(sentinel.data2)
        depmock.assert_called_once_with(sentinel.xp)
        self.assertEquals(mocksendchannel.send.call_count, 2)
        mocksendchannel.send.assert_called_with(pubchan,
                                                sentinel.data2,
                                                headers=None)