From b3a073351f40e711ff9875f803ccece20b636095 Mon Sep 17 00:00:00 2001 From: Kimonas Sotirchos Date: Thu, 30 Jan 2025 08:52:56 +0000 Subject: [PATCH] PMR: use correct capitalisation on user kind --- src/profiles_management/pmr/classes.py | 4 ++-- .../profiles_management/test_create_or_update_profiles.py | 7 +++++++ tests/samples/pmr-sample-full.yaml | 4 ++-- tests/samples/pmr-sample-single.yaml | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/profiles_management/pmr/classes.py b/src/profiles_management/pmr/classes.py index 763cd6f..2edcfc3 100644 --- a/src/profiles_management/pmr/classes.py +++ b/src/profiles_management/pmr/classes.py @@ -91,8 +91,8 @@ class ResourceQuotaSpecModel(BaseModel): class UserKind(StrEnum): """Class representing the kind of the user as a Profile owner.""" - USER = "user" - SERVICE_ACCOUNT = "service-account" + USER = "User" + SERVICE_ACCOUNT = "ServiceAccount" class ContributorRole(StrEnum): diff --git a/tests/integration/profiles_management/test_create_or_update_profiles.py b/tests/integration/profiles_management/test_create_or_update_profiles.py index c06bd08..2f49bd4 100644 --- a/tests/integration/profiles_management/test_create_or_update_profiles.py +++ b/tests/integration/profiles_management/test_create_or_update_profiles.py @@ -2,6 +2,7 @@ import pytest from lightkube import Client +from lightkube.resources.rbac_authorization_v1 import RoleBinding from profiles_management.create_or_update import create_or_update_profiles from profiles_management.pmr import classes @@ -73,7 +74,13 @@ async def test_new_profiles_created(lightkube_client: Client): created_profile_quota = classes.ResourceQuotaSpecModel.model_validate( created_profile["spec"]["resourceQuotaSpec"] ) + assert created_profile_quota == expected_quota + assert lightkube_client.get(RoleBinding, namespace=user, name="namespaceAdmin") + assert lightkube_client.get( + kfam.AuthorizationPolicy, namespace=user, name="ns-owner-access-istio" + ) + profiles.remove_profile(created_profile, lightkube_client) diff --git a/tests/samples/pmr-sample-full.yaml b/tests/samples/pmr-sample-full.yaml index 2ce252a..b49219e 100644 --- a/tests/samples/pmr-sample-full.yaml +++ b/tests/samples/pmr-sample-full.yaml @@ -1,7 +1,7 @@ profiles: - name: ml-engineers owner: - kind: user + kind: User name: admin@canonical.com resources: hard: @@ -15,7 +15,7 @@ profiles: role: view - name: data-engineers owner: - kind: user + kind: User name: admin@canonical.com contributors: - name: daniela@canonical.com diff --git a/tests/samples/pmr-sample-single.yaml b/tests/samples/pmr-sample-single.yaml index 0afb2c6..b67002f 100644 --- a/tests/samples/pmr-sample-single.yaml +++ b/tests/samples/pmr-sample-single.yaml @@ -1,7 +1,7 @@ profiles: - name: ml-engineers owner: - kind: user + kind: User name: admin@canonical.com resources: hard: