diff --git a/pybotx/client/users_api/user_from_search.py b/pybotx/client/users_api/user_from_search.py index c66a21a1..dde1a88b 100644 --- a/pybotx/client/users_api/user_from_search.py +++ b/pybotx/client/users_api/user_from_search.py @@ -4,6 +4,7 @@ from pydantic import Field from pybotx.models.api_base import VerifiedPayloadBaseModel +from pybotx.models.enums import APIUserKinds, convert_user_kind_to_domain from pybotx.models.users import UserFromSearch @@ -17,6 +18,7 @@ class BotXAPISearchUserResult(VerifiedPayloadBaseModel): department: Optional[str] = None emails: List[str] = Field(default_factory=list) other_id: Optional[str] = None + user_kind: APIUserKinds class BotXAPISearchUserResponsePayload(VerifiedPayloadBaseModel): @@ -34,4 +36,5 @@ def to_domain(self) -> UserFromSearch: department=self.result.department, emails=self.result.emails, other_id=self.result.other_id, + user_kind=convert_user_kind_to_domain(self.result.user_kind), ) diff --git a/pybotx/models/users.py b/pybotx/models/users.py index 4e545e0b..137e0e2c 100644 --- a/pybotx/models/users.py +++ b/pybotx/models/users.py @@ -2,6 +2,8 @@ from typing import List, Optional from uuid import UUID +from pybotx.models.enums import UserKinds + @dataclass class UserFromSearch: @@ -17,6 +19,7 @@ class UserFromSearch: department: User department. emails: User emails. other_id: User other identificator. + user_kind: User kind. """ huid: UUID @@ -28,3 +31,4 @@ class UserFromSearch: department: Optional[str] emails: List[str] other_id: Optional[str] + user_kind: UserKinds diff --git a/pyproject.toml b/pyproject.toml index 6d2d0404..c3f2d756 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "pybotx" -version = "0.49.0" +version = "0.50.0" description = "A python library for interacting with eXpress BotX API" authors = [ "Sidnev Nikolay ", diff --git a/tests/client/users_api/test_search_user_by_email.py b/tests/client/users_api/test_search_user_by_email.py index ff8ae488..2813d3e6 100644 --- a/tests/client/users_api/test_search_user_by_email.py +++ b/tests/client/users_api/test_search_user_by_email.py @@ -13,6 +13,7 @@ UserNotFoundError, lifespan_wrapper, ) +from pybotx.models.enums import UserKinds pytestmark = [ pytest.mark.asyncio, @@ -84,6 +85,7 @@ async def test__search_user_by_email__succeed( "company_position": "Director", "department": "Owners", "emails": ["ad_user@cts.com"], + "user_kind": "cts_user", }, }, ), @@ -109,6 +111,7 @@ async def test__search_user_by_email__succeed( department="Owners", emails=["ad_user@cts.com"], other_id=None, + user_kind=UserKinds.CTS_USER, ) assert endpoint.called diff --git a/tests/client/users_api/test_search_user_by_huid.py b/tests/client/users_api/test_search_user_by_huid.py index 9f3c1bb5..03417c7e 100644 --- a/tests/client/users_api/test_search_user_by_huid.py +++ b/tests/client/users_api/test_search_user_by_huid.py @@ -13,6 +13,7 @@ UserNotFoundError, lifespan_wrapper, ) +from pybotx.models.enums import UserKinds pytestmark = [ pytest.mark.asyncio, @@ -84,6 +85,7 @@ async def test__search_user_by_huid__succeed( "company_position": "Director", "department": "Owners", "emails": ["ad_user@cts.com"], + "user_kind": "cts_user", }, }, ), @@ -109,6 +111,7 @@ async def test__search_user_by_huid__succeed( department="Owners", emails=["ad_user@cts.com"], other_id=None, + user_kind=UserKinds.CTS_USER, ) assert endpoint.called diff --git a/tests/client/users_api/test_search_user_by_login.py b/tests/client/users_api/test_search_user_by_login.py index 734dcaf8..97595ef3 100644 --- a/tests/client/users_api/test_search_user_by_login.py +++ b/tests/client/users_api/test_search_user_by_login.py @@ -13,6 +13,7 @@ UserNotFoundError, lifespan_wrapper, ) +from pybotx.models.enums import UserKinds pytestmark = [ pytest.mark.asyncio, @@ -85,6 +86,7 @@ async def test__search_user_by_ad__succeed( "company_position": "Director", "department": "Owners", "emails": ["ad_user@cts.com"], + "user_kind": "cts_user", }, }, ), @@ -111,6 +113,7 @@ async def test__search_user_by_ad__succeed( department="Owners", emails=["ad_user@cts.com"], other_id=None, + user_kind=UserKinds.CTS_USER, ) assert endpoint.called diff --git a/tests/client/users_api/test_search_user_by_other_id.py b/tests/client/users_api/test_search_user_by_other_id.py index 777d9bec..2f8c6001 100644 --- a/tests/client/users_api/test_search_user_by_other_id.py +++ b/tests/client/users_api/test_search_user_by_other_id.py @@ -13,6 +13,7 @@ UserNotFoundError, lifespan_wrapper, ) +from pybotx.models.enums import UserKinds pytestmark = [ pytest.mark.asyncio, @@ -85,6 +86,7 @@ async def test__search_user_by_other_id__succeed( "department": "Owners", "emails": ["ad_user@cts.com"], "other_id": "some_id", + "user_kind": "cts_user", }, }, ), @@ -110,6 +112,7 @@ async def test__search_user_by_other_id__succeed( department="Owners", emails=["ad_user@cts.com"], other_id="some_id", + user_kind=UserKinds.CTS_USER, ) assert endpoint.called