예제 #1
0
    def test_get_redirects_to_login_when_not_authenticated(
            self, controller, pyramid_request):
        with pytest.raises(httpexceptions.HTTPFound) as exc:
            controller.get()

        assert exc.value.location == 'http://example.com/login?next={}'.format(
            url_quote(pyramid_request.url, safe=''))
예제 #2
0
    def test_get_redirects_if_user_not_logged_in(self, auth_ctrl,
                                                 pyramid_config, pyramid_request):
        pyramid_config.testing_securitypolicy(None)
        pyramid_request.url = 'http://example.com/auth?client_id=bar'

        with pytest.raises(httpexceptions.HTTPFound) as exc:
            auth_ctrl.get()

        assert exc.value.location == 'http://example.com/login?next={}'.format(
                                       url_quote(pyramid_request.url, safe=''))
예제 #3
0
파일: uri.py 프로젝트: openbizgit/h
def _normalize_pathsegment(segment):
    return url_quote(url_unquote(segment), safe=UNRESERVED_PATHSEGMENT)
예제 #4
0
파일: uri.py 프로젝트: JJediny/h
def _normalize_pathsegment(segment):
    return url_quote(url_unquote(segment), safe=UNRESERVED_PATHSEGMENT)