def test_it_replaces_context_with_404_exception(self, pyramid_request, testview): wrapped = unauthorized_to_not_found(testview) wrapped(HTTPForbidden(), pyramid_request) context, _ = testview.call_args[0] assert isinstance(context, HTTPNotFound)
def test_it_sets_appropriate_404_message(self, pyramid_request, testview): wrapped = unauthorized_to_not_found(testview) wrapped(HTTPNotFound(), pyramid_request) context, _ = testview.call_args[0] assert ( context.message == "Either the resource you requested doesn't exist, or you are not currently authorized to see it." )
def test_it_calls_wrapped_view_function(self, pyramid_request, testview): unauthorized_to_not_found(testview)(None, pyramid_request) assert testview.called