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=''))
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=''))
def _normalize_pathsegment(segment): return url_quote(url_unquote(segment), safe=UNRESERVED_PATHSEGMENT)
def _normalize_pathsegment(segment): return url_quote(url_unquote(segment), safe=UNRESERVED_PATHSEGMENT)