Exemple #1
0
    def test_display_no_name(self, db_request):
        version = "10.0.0"

        db_request.params = {"version": version}

        with pytest.raises(HTTPNotFound):
            pypi.display(db_request)
Exemple #2
0
    def test_display_no_name(self, db_request):
        version = "10.0.0"

        db_request.params = {"version": version}

        with pytest.raises(HTTPNotFound):
            pypi.display(db_request)
Exemple #3
0
    def test_display_no_version(self, db_request):
        name = "pip"

        db_request.params = {"name": name}

        db_request.route_path = pretend.call_recorder(
            lambda *a, **kw: f"/project/{name}/")

        result = pypi.display(db_request)

        assert isinstance(result, HTTPMovedPermanently)
        assert result.headers["Location"] == (f"/project/{name}/")
        assert result.status_code == 301
        assert db_request.route_path.calls == [
            pretend.call("packaging.project", name=name)
        ]
Exemple #4
0
    def test_display_no_version(self, db_request):
        name = "pip"

        db_request.params = {"name": name}

        db_request.route_path = pretend.call_recorder(
            lambda *a, **kw: f"/project/{name}/"
        )

        result = pypi.display(db_request)

        assert isinstance(result, HTTPMovedPermanently)
        assert result.headers["Location"] == (f"/project/{name}/")
        assert result.status_code == 301
        assert db_request.route_path.calls == [
            pretend.call("packaging.project", name=name)
        ]
Exemple #5
0
    def test_display(self, db_request):
        name = "pip"
        version = "10.0.0"

        db_request.params = {"name": name, "version": version}
        db_request.route_path = pretend.call_recorder(
            lambda *a, **kw: f'/project/{name}/{version}/')

        result = pypi.display(db_request)

        assert isinstance(result, HTTPMovedPermanently)
        assert result.headers['Location'] == (f'/project/{name}/{version}/')
        assert result.status_code == 301
        assert db_request.route_path.calls == [
            pretend.call(
                'packaging.release',
                name=name,
                version=version,
            )
        ]
Exemple #6
0
    def test_display(self, db_request):
        name = "pip"
        version = "10.0.0"

        db_request.params = {"name": name, "version": version}
        db_request.route_path = pretend.call_recorder(
            lambda *a, **kw: f'/project/{name}/{version}/'
        )

        result = pypi.display(db_request)

        assert isinstance(result, HTTPMovedPermanently)
        assert result.headers['Location'] == (
            f'/project/{name}/{version}/'
        )
        assert result.status_code == 301
        assert db_request.route_path.calls == [
            pretend.call(
                'packaging.release',
                name=name,
                version=version,
            )
        ]