Example #1
0
    def test__create_channel_sets_transport_kwarg(self):
        # if send_name is a transport, it makes sure that kwarg is passed in to node's channel (and therefore the channel)
        class FakeSendName(NameTrio, BaseTransport):
            pass

        fn = FakeSendName()
        ep = SendingBaseEndpoint(node=Mock(spec=NodeB), to_name=fn)

        ch = ep._create_channel()
        self.assertIn('transport', ep.node.channel.call_args[1])
        self.assertIn(fn, ep.node.channel.call_args[1].itervalues())
Example #2
0
    def test__create_channel_sets_transport_kwarg(self):
        # if send_name is a transport, it makes sure that kwarg is passed in to node's channel (and therefore the channel)
        class FakeSendName(NameTrio, BaseTransport):
            pass

        fn = FakeSendName()
        ep = SendingBaseEndpoint(node=Mock(spec=NodeB), to_name=fn)

        ch = ep._create_channel()
        self.assertIn('transport', ep.node.channel.call_args[1])
        self.assertIn(fn, ep.node.channel.call_args[1].itervalues())
Example #3
0
    def test_init_with_to_name_namepair(self):
        class MyNameTrio(NameTrio):
            def __init__(self):
                self._exchange = sentinel.my_exchange
                self._queue = sentinel.my_queue

        ep = SendingBaseEndpoint(to_name=MyNameTrio())
        self.assertEquals(ep._send_name.exchange, sentinel.my_exchange)
        self.assertEquals(ep._send_name.queue, sentinel.my_queue)
Example #4
0
 def test_create_endpoint_with_tuple(self):
     ep = SendingBaseEndpoint(node=Mock(spec=NodeB))
     e = ep.create_endpoint(to_name=(sentinel.ex, sentinel.name))
     self.assertIsInstance(e.channel.connect.call_args[0][0], NameTrio)
Example #5
0
 def test_create_endpoint_calls_connect(self):
     np = NameTrio(sentinel.xp, sentinel.queue)
     ep = SendingBaseEndpoint(node=Mock(spec=NodeB), to_name=np)
     e = ep.create_endpoint()
     e.channel.connect.assert_called_once_with(np)
Example #6
0
 def test_create_endpoint_with_tuple(self):
     ep = SendingBaseEndpoint(node=Mock(spec=NodeB))
     e = ep.create_endpoint(to_name=(sentinel.ex, sentinel.name))
     self.assertIsInstance(e.channel.connect.call_args[0][0], NameTrio)
Example #7
0
 def test_create_endpoint_calls_connect(self):
     np = NameTrio(sentinel.xp, sentinel.queue)
     ep = SendingBaseEndpoint(node=Mock(spec=NodeB), to_name=np)
     e = ep.create_endpoint()
     e.channel.connect.assert_called_once_with(np)
Example #8
0
 def test_init_with_old_name_gives_warn(self, mocklog):
     ep = SendingBaseEndpoint(name=(sentinel.xp, sentinel.rkey))
     self.assertEquals(ep._send_name.exchange, sentinel.xp)
     self.assertEquals(ep._send_name.queue, sentinel.rkey)
     self.assertTrue(mocklog.warn.called)
Example #9
0
 def test_init_with_to_name(self):
     ep = SendingBaseEndpoint(to_name=(sentinel.xp, sentinel.rkey))
     self.assertEquals(ep._send_name.exchange, sentinel.xp)
     self.assertEquals(ep._send_name.queue, sentinel.rkey)
Example #10
0
 def test_init(self):
     ep = SendingBaseEndpoint(node=sentinel.node)
     self.assertEquals(ep.node, sentinel.node)
     self.assertIsInstance(ep._send_name, NameTrio)