コード例 #1
0
ファイル: test_config.py プロジェクト: ztane/warehouse
    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
コード例 #2
0
ファイル: test_config.py プロジェクト: anzhaozhong/warehouse
    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."
コード例 #3
0
ファイル: test_config.py プロジェクト: anzhaozhong/warehouse
    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."
コード例 #4
0
ファイル: test_config.py プロジェクト: mbacchi/warehouse
    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."
コード例 #5
0
ファイル: test_config.py プロジェクト: mbacchi/warehouse
    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
コード例 #6
0
ファイル: test_config.py プロジェクト: mbacchi/warehouse
    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."