mock.sentinel.unauth

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

2 Examples 7

Example 1

Project: pyon Source File: test_endpoint.py
    def error_op(self):
        """
Routing method for next test, raises an IonException.
"""
        raise exception.Unauthorized(sentinel.unauth)

Example 2

Project: pyon Source File: test_endpoint.py
    def test__message_received_error_in_op(self):
        # we want to make sure IonExceptions raised in business logic get a response, now that
        # _message_received sends the responses

        class FakeMsg(object):
            pass
        cvalue = FakeMsg()

        e = RPCResponseEndpointUnit(routing_obj=self, interceptors={})
        ch = self._setup_mock_channel(value=cvalue, op="error_op")
        e.attach_channel(ch)

        e.send = Mock()

        self._do_listen(e)

        assert_called_once_with_header(self, e.send, {'status_code': 401,
                                                      'error_message': str(sentinel.unauth),
                                                      'conv-id': sentinel.conv_id,
                                                      'conv-seq': 2,
                                                      'protocol':'',
                                                      'performative':'failure'})