コード例 #1
0
ファイル: test_channel.py プロジェクト: ooici/pyon
    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)
コード例 #2
0
ファイル: test_channel.py プロジェクト: scion-network/scioncc
    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)
コード例 #3
0
ファイル: test_channel.py プロジェクト: ooici-dm/pyon
    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)
コード例 #4
0
ファイル: test_channel.py プロジェクト: oldpatricka/pyon
    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)
コード例 #5
0
ファイル: test_channel.py プロジェクト: oldpatricka/pyon
 def test_send_no_name(self, mocksendchannel):
     pubchan = PublisherChannel()
     self.assertRaises(AssertionError, pubchan.send, sentinel.data)
コード例 #6
0
ファイル: test_channel.py プロジェクト: oldpatricka/pyon
 def test_init(self, mocksendchannel):
     pubchan = PublisherChannel()
     self.assertFalse(pubchan._declared)
コード例 #7
0
ファイル: test_channel.py プロジェクト: scion-network/scioncc
 def test_init(self, mocksendchannel):
     pubchan = PublisherChannel()