mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-26 05:51:29 +00:00
test: commit will be removed
This commit is contained in:
parent
d7bbb64034
commit
a1f77918de
|
@ -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
|
@strawberry.enum
|
||||||
class UserType(Enum):
|
class UserType(Enum):
|
||||||
NORMAL = "NORMAL"
|
NORMAL = "NORMAL"
|
||||||
|
|
|
@ -2,7 +2,6 @@ from typing import Optional
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from selfprivacy_api.graphql.common_types.user import UserRepositoryError
|
|
||||||
from selfprivacy_api.utils import get_domain
|
from selfprivacy_api.utils import get_domain
|
||||||
from selfprivacy_api.models.user import UserDataUser
|
from selfprivacy_api.models.user import UserDataUser
|
||||||
from selfprivacy_api.repositories.users.abstract_user_repository import (
|
from selfprivacy_api.repositories.users.abstract_user_repository import (
|
||||||
|
@ -14,7 +13,9 @@ TEST_TOKEN = """eyJhbGciOiJFUzI1NiIsImtpZCI6IjVkNDUyNzdmZWUxY2UzZmNkMTViZDhkZjE3
|
||||||
|
|
||||||
|
|
||||||
class KanidmQueryError(Exception):
|
class KanidmQueryError(Exception):
|
||||||
"""Error occurred during Kanidm query"""
|
"""Error occurred during kanidm query"""
|
||||||
|
|
||||||
|
error: str
|
||||||
|
|
||||||
|
|
||||||
class KanidmUserRepository(AbstractUserRepository):
|
class KanidmUserRepository(AbstractUserRepository):
|
||||||
|
@ -34,16 +35,14 @@ class KanidmUserRepository(AbstractUserRepository):
|
||||||
)
|
)
|
||||||
|
|
||||||
if response.status_code != 200:
|
if response.status_code != 200:
|
||||||
raise UserRepositoryError(
|
raise KanidmQueryError(
|
||||||
error=f"Kanidm returned unexpected HTTP status code. Error: {response.text}."
|
error=f"Kanidm returned unexpected HTTP status code. Error: {response.text}."
|
||||||
)
|
)
|
||||||
json = response.json()
|
json = response.json()
|
||||||
|
|
||||||
return json["data"]
|
return json["data"]
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
raise UserRepositoryError(
|
raise KanidmQueryError(error=f"Kanidm request failed! Error: {str(error)}")
|
||||||
error=f"Kanidm request failed! Error: {str(error)}"
|
|
||||||
)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def create_user(username: str, password: str):
|
def create_user(username: str, password: str):
|
||||||
|
|
Loading…
Reference in a new issue