From c783ce17be9c9225de2fa26f3935414f4b2be32a Mon Sep 17 00:00:00 2001 From: Kevin Morris Date: Fri, 4 Feb 2022 19:55:36 -0800 Subject: [PATCH] fix: remove erroneous official pkg check This causes an issue that should have been obvious from the get-go: if a package request is up in the AUR, but the package has already been picked up by an official repository, we would end up returning a 404 here, leading a TU to not be able to perform an action for a request's target. Signed-off-by: Kevin Morris --- aurweb/packages/util.py | 7 ------- test/test_packages_routes.py | 15 --------------- 2 files changed, 22 deletions(-) diff --git a/aurweb/packages/util.py b/aurweb/packages/util.py index 21b5fab8..ded1554f 100644 --- a/aurweb/packages/util.py +++ b/aurweb/packages/util.py @@ -98,17 +98,10 @@ def get_pkg_or_base( :raises HTTPException: With status code 404 if record doesn't exist :return: {Package,PackageBase} instance """ - provider = db.query(models.OfficialProvider).filter( - models.OfficialProvider.Name == name).first() - if provider: - raise HTTPException(status_code=HTTPStatus.NOT_FOUND) - with db.begin(): instance = db.query(cls).filter(cls.Name == name).first() - if not instance: raise HTTPException(status_code=HTTPStatus.NOT_FOUND) - return instance diff --git a/test/test_packages_routes.py b/test/test_packages_routes.py index adafe1ae..ee837912 100644 --- a/test/test_packages_routes.py +++ b/test/test_packages_routes.py @@ -203,21 +203,6 @@ def test_package_not_found(client: TestClient): assert resp.status_code == int(HTTPStatus.NOT_FOUND) -def test_package_official_not_found(client: TestClient, package: Package): - """ When a Package has a matching OfficialProvider record, it is not - hosted on AUR, but in the official repositories. Getting a package - with this kind of record should return a status code 404. """ - with db.begin(): - db.create(OfficialProvider, - Name=package.Name, - Repo="core", - Provides=package.Name) - - with client as request: - resp = request.get(package_endpoint(package)) - assert resp.status_code == int(HTTPStatus.NOT_FOUND) - - def test_package(client: TestClient, package: Package): """ Test a single / packages / {name} route. """