Ejemplo n.º 1
0
class TestBidirClientChannel(PyonTestCase):
    def setUp(self):
        self.ch = BidirClientChannel()

    def test__send_with_reply_to(self, mocksendchannel):

        self.ch._recv_name = NameTrio(sentinel.xp, sentinel.queue)

        self.ch._send(sentinel.name,
                      sentinel.data,
                      headers={sentinel.header_key: sentinel.header_value})

        mocksendchannel._send.assert_called_with(
            self.ch,
            sentinel.name,
            sentinel.data,
            headers={
                sentinel.header_key: sentinel.header_value,
                'reply-to': '%s,%s' % (sentinel.xp, sentinel.queue)
            })

    def test__send_with_no_reply_to(self, mocksendchannel):

        # must set recv_name
        self.ch._recv_name = NameTrio(sentinel.xp, sentinel.queue)

        self.ch._send(sentinel.name, sentinel.data)

        mocksendchannel._send.assert_called_with(
            self.ch,
            sentinel.name,
            sentinel.data,
            headers={'reply-to': "%s,%s" % (sentinel.xp, sentinel.queue)})
Ejemplo n.º 2
0
class TestBidirClientChannel(PyonTestCase):

    # @TODO: have to do this because i'm patching the class, anything to be done?
    def test_verify_service(self, mocksendchannel):
        PyonTestCase.test_verify_service(self)

    def setUp(self):
        self.ch = BidirClientChannel()

    def test__send_with_reply_to(self, mocksendchannel):

        self.ch._recv_name = NameTrio(sentinel.xp, sentinel.queue)

        self.ch._send(sentinel.name, sentinel.data, headers={sentinel.header_key: sentinel.header_value})

        mocksendchannel._send.assert_called_with(self.ch,
                                                 sentinel.name,
                                                 sentinel.data,
                                                 headers={sentinel.header_key: sentinel.header_value, 'reply-to': '%s,%s' % (sentinel.xp, sentinel.queue)})


    def test__send_with_no_reply_to(self, mocksendchannel):

        # must set recv_name
        self.ch._recv_name = NameTrio(sentinel.xp, sentinel.queue)

        self.ch._send(sentinel.name, sentinel.data)

        mocksendchannel._send.assert_called_with(self.ch, sentinel.name, sentinel.data, headers={'reply-to':"%s,%s" % (sentinel.xp, sentinel.queue)})
Ejemplo n.º 3
0
class TestBidirClientChannel(PyonTestCase):

    def setUp(self):
        self.ch = BidirClientChannel()

    def test__send_with_reply_to(self, mocksendchannel):

        self.ch._recv_name = NameTrio(sentinel.xp, sentinel.queue)

        self.ch._send(sentinel.name, sentinel.data, headers={sentinel.header_key: sentinel.header_value})

        mocksendchannel._send.assert_called_with(self.ch,
                                                 sentinel.name,
                                                 sentinel.data,
                                                 headers={sentinel.header_key: sentinel.header_value, 'reply-to': '%s,%s' % (sentinel.xp, sentinel.queue)})


    def test__send_with_no_reply_to(self, mocksendchannel):

        # must set recv_name
        self.ch._recv_name = NameTrio(sentinel.xp, sentinel.queue)

        self.ch._send(sentinel.name, sentinel.data)

        mocksendchannel._send.assert_called_with(self.ch, sentinel.name, sentinel.data, headers={'reply-to':"%s,%s" % (sentinel.xp, sentinel.queue)})
Ejemplo n.º 4
0
class TestBidirClientChannel(PyonTestCase):

    # @TODO: have to do this because i'm patching the class, anything to be done?
    def test_verify_service(self, mocksendchannel):
        PyonTestCase.test_verify_service(self)

    def setUp(self):
        self.ch = BidirClientChannel()

    def test__send_with_reply_to(self, mocksendchannel):

        self.ch._recv_name = NameTrio(sentinel.xp, sentinel.queue)

        self.ch._send(sentinel.name,
                      sentinel.data,
                      headers={sentinel.header_key: sentinel.header_value})

        mocksendchannel._send.assert_called_with(
            self.ch,
            sentinel.name,
            sentinel.data,
            headers={
                sentinel.header_key: sentinel.header_value,
                'reply-to': '%s,%s' % (sentinel.xp, sentinel.queue)
            })

    def test__send_with_no_reply_to(self, mocksendchannel):

        # must set recv_name
        self.ch._recv_name = NameTrio(sentinel.xp, sentinel.queue)

        self.ch._send(sentinel.name, sentinel.data)

        mocksendchannel._send.assert_called_with(
            self.ch,
            sentinel.name,
            sentinel.data,
            headers={'reply-to': "%s,%s" % (sentinel.xp, sentinel.queue)})