Exemple #1
0
    def test__build_header(self, mockr, mockp):

        mockr.return_value = {'one':1, 'two':2}
        mockp.return_value = {'two':-2, 'three':3}

        ep = ProcessRPCResponseEndpointUnit()
        header = ep._build_header(sentinel.raw_msg)

        self.assertEquals(header, {'one':1, 'two':-2, 'three':3})
Exemple #2
0
    def test__build_header(self, mockr, mockp):

        mockr.return_value = {"one": 1, "two": 2}
        mockp.return_value = {"two": -2, "three": 3}

        ep = ProcessRPCResponseEndpointUnit()
        header = ep._build_header(sentinel.raw_msg)

        self.assertEquals(header, {"one": 1, "two": -2, "three": 3})
Exemple #3
0
    def test__message_received(self, mockmr):
        procmock = Mock()
        procmock.push_context = MagicMock()

        ep = ProcessRPCResponseEndpointUnit(process=procmock)
        ep._message_received(sentinel.msg, sentinel.headers)

        procmock.push_context.assert_called_once_with(sentinel.headers)
        procmock.push_context().__enter__.assert_called_once_with()
        mockmr.assert_called_once_with(ep, sentinel.msg, sentinel.headers)
Exemple #4
0
    def test__message_received(self, mockmr):
        procmock = Mock()
        procmock.push_context = MagicMock()

        ep = ProcessRPCResponseEndpointUnit(process=procmock)
        ep._message_received(sentinel.msg, sentinel.headers)

        procmock.push_context.assert_called_once_with(sentinel.headers)
        procmock.push_context().__enter__.assert_called_once_with()
        mockmr.assert_called_once_with(ep, sentinel.msg, sentinel.headers)
Exemple #5
0
    def test_init(self, mockr, mockp):

        ep = ProcessRPCResponseEndpointUnit(process=sentinel.process, other=sentinel.other)
        mockp.assert_called_once_with(ep, process=sentinel.process)
        mockr.assert_called_once_with(ep, other=sentinel.other)