From a1f77918ded0201ecedb5dd29b235e13a8c548fc Mon Sep 17 00:00:00 2001 From: dettlaff Date: Mon, 11 Nov 2024 12:41:30 +0400 Subject: [PATCH] test: commit will be removed --- selfprivacy_api/graphql/common_types/user.py | 7 ------- .../repositories/users/kanidm_user_repository.py | 11 +++++------ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/selfprivacy_api/graphql/common_types/user.py b/selfprivacy_api/graphql/common_types/user.py index 69b81e2..4e6bb63 100644 --- a/selfprivacy_api/graphql/common_types/user.py +++ b/selfprivacy_api/graphql/common_types/user.py @@ -13,13 +13,6 @@ from selfprivacy_api.graphql.mutations.mutation_interface import ( ) -@strawberry.type -class UserRepositoryError(Exception): - """Error occurred during repo query""" - - error: str - - @strawberry.enum class UserType(Enum): NORMAL = "NORMAL" diff --git a/selfprivacy_api/repositories/users/kanidm_user_repository.py b/selfprivacy_api/repositories/users/kanidm_user_repository.py index 4060320..1134f16 100644 --- a/selfprivacy_api/repositories/users/kanidm_user_repository.py +++ b/selfprivacy_api/repositories/users/kanidm_user_repository.py @@ -2,7 +2,6 @@ from typing import Optional import requests -from selfprivacy_api.graphql.common_types.user import UserRepositoryError from selfprivacy_api.utils import get_domain from selfprivacy_api.models.user import UserDataUser from selfprivacy_api.repositories.users.abstract_user_repository import ( @@ -14,7 +13,9 @@ TEST_TOKEN = """eyJhbGciOiJFUzI1NiIsImtpZCI6IjVkNDUyNzdmZWUxY2UzZmNkMTViZDhkZjE3 class KanidmQueryError(Exception): - """Error occurred during Kanidm query""" + """Error occurred during kanidm query""" + + error: str class KanidmUserRepository(AbstractUserRepository): @@ -34,16 +35,14 @@ class KanidmUserRepository(AbstractUserRepository): ) if response.status_code != 200: - raise UserRepositoryError( + raise KanidmQueryError( error=f"Kanidm returned unexpected HTTP status code. Error: {response.text}." ) json = response.json() return json["data"] except Exception as error: - raise UserRepositoryError( - error=f"Kanidm request failed! Error: {str(error)}" - ) + raise KanidmQueryError(error=f"Kanidm request failed! Error: {str(error)}") @staticmethod def create_user(username: str, password: str):