From 62a8d82bbc7344e7dbfa10b58d4ee025c80d0341 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Bompard?= Date: Tue, 5 Nov 2024 15:00:00 +0100 Subject: [PATCH] Cache the project name instead of its fullname MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: #1234 Signed-off-by: Aurélien Bompard --- changelog.d/1234.fixed | 1 + fmn/rules/tracking_rules.py | 2 +- tests/rules/tracking_rules/test_artifacts_group_owned.py | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 changelog.d/1234.fixed diff --git a/changelog.d/1234.fixed b/changelog.d/1234.fixed new file mode 100644 index 000000000..4ba99a5f7 --- /dev/null +++ b/changelog.d/1234.fixed @@ -0,0 +1 @@ +Cache the project name instead of its fullname diff --git a/fmn/rules/tracking_rules.py b/fmn/rules/tracking_rules.py index 2c8661772..2c003e46e 100644 --- a/fmn/rules/tracking_rules.py +++ b/fmn/rules/tracking_rules.py @@ -83,7 +83,7 @@ async def prime_cache(self, cache): for role in PagureRole.GROUP_ROLES_MAINTAINER_SET: for artifact_type in ArtifactType: getattr(cache, artifact_type.name).update( - p["fullname"] + p["name"] for p in owned if p["namespace"] == artifact_type.value and group in p["access_groups"].get(role.name.lower(), ()) diff --git a/tests/rules/tracking_rules/test_artifacts_group_owned.py b/tests/rules/tracking_rules/test_artifacts_group_owned.py index d5db6ddc4..253760912 100644 --- a/tests/rules/tracking_rules/test_artifacts_group_owned.py +++ b/tests/rules/tracking_rules/test_artifacts_group_owned.py @@ -29,8 +29,8 @@ async def test_artifacts_group_owned_cache(requester, cache): tr = ArtifactsGroupOwned(requester, ["group1"], owner="testuser") await tr.prime_cache(cache) assert cache == Tracked( - packages=set(["rpms/rpms-1", "rpms/rpms-2"]), - containers=set(["containers/containers-1", "containers/containers-2"]), - modules=set(["modules/modules-1", "modules/modules-2"]), - flatpaks=set(["flatpaks/flatpaks-1", "flatpaks/flatpaks-2"]), + packages=set(["rpms-1", "rpms-2"]), + containers=set(["containers-1", "containers-2"]), + modules=set(["modules-1", "modules-2"]), + flatpaks=set(["flatpaks-1", "flatpaks-2"]), )