コード例 #1
0
    def test_basic_query(self, db_request):
        projects = sorted([ProjectFactory.create() for _ in range(5)],
                          key=lambda p: p.normalized_name)
        db_request.GET["q"] = projects[0].name
        result = views.project_list(db_request)

        assert result == {"projects": [projects[0]], "query": projects[0].name}
コード例 #2
0
    def test_no_query(self, db_request):
        projects = sorted(
            [ProjectFactory.create() for _ in range(30)],
            key=lambda p: p.normalized_name,
        )
        result = views.project_list(db_request)

        assert result == {"projects": projects[:25], "query": None}
コード例 #3
0
ファイル: test_projects.py プロジェクト: craig5/warehouse
    def test_basic_query(self, db_request):
        projects = sorted(
            [ProjectFactory.create() for _ in range(5)], key=lambda p: p.normalized_name
        )
        db_request.GET["q"] = projects[0].name
        result = views.project_list(db_request)

        assert result == {"projects": [projects[0]], "query": projects[0].name}
コード例 #4
0
ファイル: test_projects.py プロジェクト: craig5/warehouse
    def test_no_query(self, db_request):
        projects = sorted(
            [ProjectFactory.create() for _ in range(30)],
            key=lambda p: p.normalized_name,
        )
        result = views.project_list(db_request)

        assert result == {"projects": projects[:25], "query": None}
コード例 #5
0
    def test_with_page(self, db_request):
        projects = sorted(
            [ProjectFactory.create() for _ in range(30)],
            key=lambda p: p.normalized_name,
        )
        db_request.GET["page"] = "2"
        result = views.project_list(db_request)

        assert result == {"projects": projects[25:], "query": None}
コード例 #6
0
ファイル: test_projects.py プロジェクト: craig5/warehouse
    def test_with_page(self, db_request):
        projects = sorted(
            [ProjectFactory.create() for _ in range(30)],
            key=lambda p: p.normalized_name,
        )
        db_request.GET["page"] = "2"
        result = views.project_list(db_request)

        assert result == {"projects": projects[25:], "query": None}
コード例 #7
0
    def test_with_invalid_page(self):
        request = pretend.stub(params={"page": "not an integer"})

        with pytest.raises(HTTPBadRequest):
            views.project_list(request)
コード例 #8
0
ファイル: test_projects.py プロジェクト: ewdurbin/warehouse
    def test_with_invalid_page(self):
        request = pretend.stub(params={"page": "not an integer"})

        with pytest.raises(HTTPBadRequest):
            views.project_list(request)