mock.sentinel.binding

Here are the examples of the python api mock.sentinel.binding taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

4 Examples 7

Example 1

Project: pyon Source File: test_exchange.py
    def test_xn_setup_listener(self):
        xn      = self.ex_manager.create_xn_service('servicename')
        qstr    = '%s.%s' % (xn.exchange, 'servicename')        # what we expect the queue name to look like

        xn.setup_listener(sentinel.binding, None)

        self.pt.bind_impl.assert_called_once_with(xn.exchange, qstr, sentinel.binding)

Example 2

Project: pyon Source File: test_channel.py
    def test__bind_no_name(self):
        self.assertRaises(AssertionError, self.ch._bind, sentinel.binding)

Example 3

Project: pyon Source File: test_endpoint.py
    def test_listen_with_base_transport_for_name(self):

        # make a listen loop that will exit right away
        chmock = Mock(spec=ListenChannel)
        chmock.accept.side_effect = ChannelClosedError

        nodemock = Mock(spec=NodeB)
        nodemock.channel.return_value = chmock

        class FakeRecvName(BaseTransport, NameTrio):
            pass
        recv_name = FakeRecvName()
        recv_name.setup_listener = Mock()

        ep = ListeningBaseEndpoint(node=nodemock, from_name=recv_name)
        ep.listen(binding=sentinel.binding)

        self.assertTrue(ep.get_ready_event().is_set())
        self.assertIn('transport', nodemock.channel.call_args[1])
        self.assertIn(recv_name, nodemock.channel.call_args[1].itervalues())

Example 4

Project: pyon Source File: test_transport.py
Function: test_setup_listener
    def test_setup_listener(self):
        cb = Mock()
        self.tp.setup_listener(sentinel.binding, cb)

        cb.assert_called_once_with(self.tp, sentinel.binding)