def test_not_redirect(self): response = pretend.stub(location=None) handler = pretend.call_recorder(lambda request: response) registry = pretend.stub() tween = config.unicode_redirect_tween_factory(handler, registry) request = pretend.stub(path="/wu/tang/") assert tween(request) == response
def test_unicode_basic_redirect(self): response = pretend.stub(location="/pypi/\u2603/json/") handler = pretend.call_recorder(lambda request: response) registry = pretend.stub() tween = config.unicode_redirect_tween_factory(handler, registry) request = pretend.stub(path="/pypi/snowman/json/") assert tween(request).location == "/pypi/%E2%98%83/json/"
def test_basic_redirect(self): response = pretend.stub(location="/a/path/to/nowhere") handler = pretend.call_recorder(lambda request: response) registry = pretend.stub() tween = config.unicode_redirect_tween_factory(handler, registry) request = pretend.stub(path="/A/pAtH/tO/nOwHeRe/") assert tween(request) == response
def test_not_redirect(self): response = pretend.stub(location=None) handler = pretend.call_recorder(lambda request: response) registry = pretend.stub() tween = config.unicode_redirect_tween_factory( handler, registry) request = pretend.stub( path="/wu/tang/", ) assert tween(request) == response
def test_unicode_basic_redirect(self): response = pretend.stub(location="/pypi/\u2603/json/") handler = pretend.call_recorder(lambda request: response) registry = pretend.stub() tween = config.unicode_redirect_tween_factory( handler, registry) request = pretend.stub( path="/pypi/snowman/json/", ) assert tween(request).location == "/pypi/%E2%98%83/json/"
def test_basic_redirect(self): response = pretend.stub(location="/a/path/to/nowhere") handler = pretend.call_recorder(lambda request: response) registry = pretend.stub() tween = config.unicode_redirect_tween_factory( handler, registry) request = pretend.stub( path="/A/pAtH/tO/nOwHeRe/", ) assert tween(request) == response