Beispiel #1
0
 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
Beispiel #2
0
 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/"
Beispiel #3
0
 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
Beispiel #4
0
 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
Beispiel #5
0
 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/"
Beispiel #6
0
 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