mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-01-30 20:56:39 +00:00
fix: add type debbug
This commit is contained in:
parent
be9be5c975
commit
41ca72ae24
|
@ -101,8 +101,6 @@ class UsersMutations:
|
|||
UsernameTooLong,
|
||||
InvalidConfiguration,
|
||||
KanidmDidNotReturnAdminPassword,
|
||||
KanidmReturnUnknownResponseType,
|
||||
KanidmReturnEmptyResponse,
|
||||
KanidmQueryError,
|
||||
) as error:
|
||||
return return_failed_mutation_return(
|
||||
|
@ -177,8 +175,6 @@ class UsersMutations:
|
|||
PasswordIsEmpty,
|
||||
SelfPrivacyAppIsOutdate,
|
||||
KanidmDidNotReturnAdminPassword,
|
||||
KanidmReturnUnknownResponseType,
|
||||
KanidmReturnEmptyResponse,
|
||||
KanidmQueryError,
|
||||
) as error:
|
||||
return return_failed_mutation_return(
|
||||
|
|
|
@ -102,20 +102,22 @@ class KanidmAdminToken: # TODO CHECK IS TOKEN CORRECT?
|
|||
|
||||
|
||||
class KanidmUserRepository(AbstractUserRepository):
|
||||
"""
|
||||
Validates the type and that content of the response data is not empty.
|
||||
|
||||
Args:
|
||||
data_type (str): Expected type of response data ('list' or 'dict').
|
||||
response_data (any): Response data to validate.
|
||||
|
||||
Raises:
|
||||
KanidmReturnEmptyResponse: If the response data is empty.
|
||||
KanidmReturnUnknownResponseType: If the response data is not of the expected type.
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def _check_response_type_and_not_empty(data_type: str, response_data: Any) -> None:
|
||||
"""
|
||||
Validates the type and that content of the response data is not empty.
|
||||
|
||||
Args:
|
||||
data_type (str): Expected type of response data ('list' or 'dict').
|
||||
response_data (any): Response data to validate.
|
||||
|
||||
Raises:
|
||||
KanidmReturnEmptyResponse: If the response data is empty.
|
||||
KanidmReturnUnknownResponseType: If the response data is not of the expected type.
|
||||
"""
|
||||
|
||||
logging.info(response_data)
|
||||
|
||||
if data_type == "list":
|
||||
if not isinstance(response_data, list):
|
||||
raise KanidmReturnUnknownResponseType(response_data=response_data)
|
||||
|
@ -128,9 +130,6 @@ class KanidmUserRepository(AbstractUserRepository):
|
|||
if not response_data.get("data"):
|
||||
raise KanidmReturnEmptyResponse
|
||||
|
||||
else:
|
||||
raise KanidmReturnUnknownResponseType(response_data=response_data)
|
||||
|
||||
@staticmethod
|
||||
def _check_user_origin_by_memberof(
|
||||
memberof: list[str] = [],
|
||||
|
@ -173,8 +172,6 @@ class KanidmUserRepository(AbstractUserRepository):
|
|||
|
||||
raise KanidmQueryError(error_text=response.text)
|
||||
|
||||
# nomatchingentries
|
||||
|
||||
@staticmethod
|
||||
def create_user(
|
||||
username: str,
|
||||
|
|
Loading…
Reference in a new issue