Esempio n. 1
0
    def test_context_is_not_found(self, pyramid_request, testview):
        wrapped = normalize_not_found(testview)

        # This view decorator would never have a reason to deal with
        # a 403 as a context, but it would be valid
        wrapped(HTTPForbidden(), pyramid_request)

        context, _ = testview.call_args[0]
        assert isinstance(context, HTTPNotFound)
Esempio n. 2
0
    def test_context_is_not_found(self, pyramid_request, testview):
        wrapped = normalize_not_found(testview)

        # This view decorator would never have a reason to deal with
        # a 403 as a context, but it would be valid
        wrapped(HTTPForbidden(), pyramid_request)

        context, _ = testview.call_args[0]
        assert isinstance(context, HTTPNotFound)
Esempio n. 3
0
    def test_it_sets_appropriate_message(self, pyramid_request, testview):
        wrapped = normalize_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."
        )
Esempio n. 4
0
    def test_it_sets_appropriate_message(self, pyramid_request, testview):
        wrapped = normalize_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."
        )