Пример #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
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)