def test_valid(self): response = pretend.stub() handler = pretend.call_recorder(lambda request: response) tween = config.junk_encoding_tween_factory(handler, pretend.stub()) request = Request({"QUERY_STRING": ":action=browse", "PATH_INFO": "/pypi"}) resp = tween(request) assert resp is response
def test_invalid_path(self): response = pretend.stub() handler = pretend.call_recorder(lambda request: response) tween = config.junk_encoding_tween_factory(handler, pretend.stub()) request = Request({"PATH_INFO": "/projects/abouÅt"}) resp = tween(request) assert resp is not response assert resp.status_code == 400 assert resp.detail == "Invalid bytes in URL."
def test_invalid_qsl(self): response = pretend.stub() handler = pretend.call_recorder(lambda request: response) tween = config.junk_encoding_tween_factory(handler, pretend.stub()) request = Request({"QUERY_STRING": "%Aaction=browse"}) resp = tween(request) assert resp is not response assert resp.status_code == 400 assert resp.detail == "Invalid bytes in query string."
def test_valid(self): response = pretend.stub() handler = pretend.call_recorder(lambda request: response) tween = config.junk_encoding_tween_factory(handler, pretend.stub()) request = Request({ "QUERY_STRING": ":action=browse", "PATH_INFO": "/pypi", }) resp = tween(request) assert resp is response
def test_invalid_path(self): response = pretend.stub() handler = pretend.call_recorder(lambda request: response) tween = config.junk_encoding_tween_factory(handler, pretend.stub()) request = Request({ "PATH_INFO": "/projects/abouÅt", }) resp = tween(request) assert resp is not response assert resp.status_code == 400 assert resp.detail == "Invalid bytes in URL."