From 22721fe99bffb866f36299f74844e9e9ce8a28a7 Mon Sep 17 00:00:00 2001 From: Leonid Gorbunov Date: Mon, 29 Jul 2024 13:09:42 +0300 Subject: [PATCH] feat: Added fields into UserFromSearch: active, created_at, cts_id, description, ip_phone, manager, office, other_ip_phone, other_phone, public_name, rts_id, update_at --- pybotx/client/users_api/user_from_search.py | 36 +++++++++++++++++++ pybotx/models/users.py | 24 +++++++++++++ pyproject.toml | 2 +- .../users_api/test_search_user_by_email.py | 24 +++++++++++++ .../users_api/test_search_user_by_emails.py | 24 +++++++++++++ .../users_api/test_search_user_by_huid.py | 24 +++++++++++++ .../users_api/test_search_user_by_login.py | 24 +++++++++++++ .../users_api/test_search_user_by_other_id.py | 24 +++++++++++++ 8 files changed, 181 insertions(+), 1 deletion(-) diff --git a/pybotx/client/users_api/user_from_search.py b/pybotx/client/users_api/user_from_search.py index 7af8c492..8ca3c579 100644 --- a/pybotx/client/users_api/user_from_search.py +++ b/pybotx/client/users_api/user_from_search.py @@ -19,6 +19,18 @@ class BotXAPISearchUserResult(VerifiedPayloadBaseModel): emails: List[str] = Field(default_factory=list) other_id: Optional[str] = None user_kind: APIUserKinds + active: Optional[bool] = None + created_at: Optional[str] = None + cts_id: Optional[str] = None + description: Optional[str] = None + ip_phone: Optional[int] = None + manager: Optional[str] = None + office: Optional[str] = None + other_ip_phone: Optional[int] = None + other_phone: Optional[int] = None + public_name: Optional[str] = None + rts_id: Optional[str] = None + updated_at: Optional[str] = None class BotXAPISearchUserResponsePayload(VerifiedPayloadBaseModel): @@ -37,6 +49,18 @@ def to_domain(self) -> UserFromSearch: emails=self.result.emails, other_id=self.result.other_id, user_kind=convert_user_kind_to_domain(self.result.user_kind), + active=None if self.result.active is None else bool(self.result.active), + created_at=self.result.created_at, + cts_id=self.result.cts_id, + description=self.result.description, + ip_phone=self.result.ip_phone, + manager=self.result.manager, + office=self.result.office, + other_ip_phone=self.result.other_ip_phone, + other_phone=self.result.other_phone, + public_name=self.result.public_name, + rts_id=self.result.rts_id, + updated_at=self.result.updated_at, ) @@ -57,6 +81,18 @@ def to_domain(self) -> List[UserFromSearch]: emails=user.emails, other_id=user.other_id, user_kind=convert_user_kind_to_domain(user.user_kind), + active=None if user.active is None else bool(user.active), + created_at=user.created_at, + cts_id=user.cts_id, + description=user.description, + ip_phone=user.ip_phone, + manager=user.manager, + office=user.office, + other_ip_phone=user.other_ip_phone, + other_phone=user.other_phone, + public_name=user.public_name, + rts_id=user.rts_id, + updated_at=user.updated_at, ) for user in self.result ] diff --git a/pybotx/models/users.py b/pybotx/models/users.py index 1eb91380..06848b4c 100644 --- a/pybotx/models/users.py +++ b/pybotx/models/users.py @@ -20,6 +20,18 @@ class UserFromSearch: emails: User emails. other_id: User other identificator. user_kind: User kind. + active: User active status. + created_at: User creation timestamp. + cts_id: User CTS id. + description: User description. + ip_phone: User IP phone. + manager: User manager. + office: User office. + other_ip_phone: User other IP phone. + other_phone: User other phone. + public_name: User public name. + rts_id: User RTS id. + updated_at: User update timestamp. """ huid: UUID @@ -32,6 +44,18 @@ class UserFromSearch: emails: List[str] other_id: Optional[str] user_kind: UserKinds + active: Optional[bool] = None + created_at: Optional[str] = None + cts_id: Optional[str] = None + description: Optional[str] = None + ip_phone: Optional[int] = None + manager: Optional[str] = None + office: Optional[str] = None + other_ip_phone: Optional[int] = None + other_phone: Optional[int] = None + public_name: Optional[str] = None + rts_id: Optional[str] = None + updated_at: Optional[str] = None @dataclass diff --git a/pyproject.toml b/pyproject.toml index 731023e2..882dfd4b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "pybotx" -version = "0.68.1" +version = "0.69.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 2813d3e6..deddfc83 100644 --- a/tests/client/users_api/test_search_user_by_email.py +++ b/tests/client/users_api/test_search_user_by_email.py @@ -86,6 +86,18 @@ async def test__search_user_by_email__succeed( "department": "Owners", "emails": ["ad_user@cts.com"], "user_kind": "cts_user", + "active": True, + "created_at": "2023-03-26T14:36:08.740618Z", + "cts_id": "e0140f4c-4af2-5a2e-9ad1-5f37fceafbaf", + "description": "Director in Owners dep", + "ip_phone": 1271020, + "manager": "Alice", + "office": "SUN", + "other_ip_phone": None, + "other_phone": None, + "public_name": "Bobby", + "rts_id": "f46440a4-d930-58d4-b3f5-8110ab846ee3", + "updated_at": "2023-03-26T14:36:08.740618Z", }, }, ), @@ -112,6 +124,18 @@ async def test__search_user_by_email__succeed( emails=["ad_user@cts.com"], other_id=None, user_kind=UserKinds.CTS_USER, + active=True, + created_at="2023-03-26T14:36:08.740618Z", + cts_id="e0140f4c-4af2-5a2e-9ad1-5f37fceafbaf", + description="Director in Owners dep", + ip_phone=1271020, + manager="Alice", + office="SUN", + other_ip_phone=None, + other_phone=None, + public_name="Bobby", + rts_id="f46440a4-d930-58d4-b3f5-8110ab846ee3", + updated_at="2023-03-26T14:36:08.740618Z", ) assert endpoint.called diff --git a/tests/client/users_api/test_search_user_by_emails.py b/tests/client/users_api/test_search_user_by_emails.py index aeb23290..24ff2734 100644 --- a/tests/client/users_api/test_search_user_by_emails.py +++ b/tests/client/users_api/test_search_user_by_emails.py @@ -50,6 +50,18 @@ async def test__search_user_by_email__succeed( "department": "Owners", "emails": user_emails, "user_kind": "cts_user", + "active": False, + "created_at": "2023-03-26T14:36:08.740618Z", + "cts_id": "e0140f4c-4af2-5a2e-9ad1-5f37fceafbaf", + "description": "Director in Owners dep", + "ip_phone": 1271020, + "manager": "Alice", + "office": "SUN", + "other_ip_phone": None, + "other_phone": None, + "public_name": "Bobby", + "rts_id": "f46440a4-d930-58d4-b3f5-8110ab846ee3", + "updated_at": "2023-03-26T14:36:08.740618Z", }, ], }, @@ -77,6 +89,18 @@ async def test__search_user_by_email__succeed( emails=user_emails, other_id=None, user_kind=UserKinds.CTS_USER, + active=False, + created_at="2023-03-26T14:36:08.740618Z", + cts_id="e0140f4c-4af2-5a2e-9ad1-5f37fceafbaf", + description="Director in Owners dep", + ip_phone=1271020, + manager="Alice", + office="SUN", + other_ip_phone=None, + other_phone=None, + public_name="Bobby", + rts_id="f46440a4-d930-58d4-b3f5-8110ab846ee3", + updated_at="2023-03-26T14:36:08.740618Z", ) 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 03417c7e..d15951b0 100644 --- a/tests/client/users_api/test_search_user_by_huid.py +++ b/tests/client/users_api/test_search_user_by_huid.py @@ -86,6 +86,18 @@ async def test__search_user_by_huid__succeed( "department": "Owners", "emails": ["ad_user@cts.com"], "user_kind": "cts_user", + "active": None, + "created_at": "2023-03-26T14:36:08.740618Z", + "cts_id": "e0140f4c-4af2-5a2e-9ad1-5f37fceafbaf", + "description": "Director in Owners dep", + "ip_phone": 1271020, + "manager": "Alice", + "office": "SUN", + "other_ip_phone": None, + "other_phone": None, + "public_name": "Bobby", + "rts_id": "f46440a4-d930-58d4-b3f5-8110ab846ee3", + "updated_at": "2023-03-26T14:36:08.740618Z", }, }, ), @@ -112,6 +124,18 @@ async def test__search_user_by_huid__succeed( emails=["ad_user@cts.com"], other_id=None, user_kind=UserKinds.CTS_USER, + active=None, + created_at="2023-03-26T14:36:08.740618Z", + cts_id="e0140f4c-4af2-5a2e-9ad1-5f37fceafbaf", + description="Director in Owners dep", + ip_phone=1271020, + manager="Alice", + office="SUN", + other_ip_phone=None, + other_phone=None, + public_name="Bobby", + rts_id="f46440a4-d930-58d4-b3f5-8110ab846ee3", + updated_at="2023-03-26T14:36:08.740618Z", ) 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 97595ef3..00edb401 100644 --- a/tests/client/users_api/test_search_user_by_login.py +++ b/tests/client/users_api/test_search_user_by_login.py @@ -87,6 +87,18 @@ async def test__search_user_by_ad__succeed( "department": "Owners", "emails": ["ad_user@cts.com"], "user_kind": "cts_user", + "active": None, + "created_at": "2023-03-26T14:36:08.740618Z", + "cts_id": "e0140f4c-4af2-5a2e-9ad1-5f37fceafbaf", + "description": "Director in Owners dep", + "ip_phone": 1271020, + "manager": "Alice", + "office": "SUN", + "other_ip_phone": None, + "other_phone": None, + "public_name": "Bobby", + "rts_id": "f46440a4-d930-58d4-b3f5-8110ab846ee3", + "updated_at": "2023-03-26T14:36:08.740618Z", }, }, ), @@ -114,6 +126,18 @@ async def test__search_user_by_ad__succeed( emails=["ad_user@cts.com"], other_id=None, user_kind=UserKinds.CTS_USER, + active=None, + created_at="2023-03-26T14:36:08.740618Z", + cts_id="e0140f4c-4af2-5a2e-9ad1-5f37fceafbaf", + description="Director in Owners dep", + ip_phone=1271020, + manager="Alice", + office="SUN", + other_ip_phone=None, + other_phone=None, + public_name="Bobby", + rts_id="f46440a4-d930-58d4-b3f5-8110ab846ee3", + updated_at="2023-03-26T14:36:08.740618Z", ) 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 2f8c6001..e0fb9510 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 @@ -87,6 +87,18 @@ async def test__search_user_by_other_id__succeed( "emails": ["ad_user@cts.com"], "other_id": "some_id", "user_kind": "cts_user", + "active": True, + "created_at": "2023-03-26T14:36:08.740618Z", + "cts_id": "e0140f4c-4af2-5a2e-9ad1-5f37fceafbaf", + "description": "Director in Owners dep", + "ip_phone": 1271020, + "manager": "Alice", + "office": "SUN", + "other_ip_phone": None, + "other_phone": None, + "public_name": "Bobby", + "rts_id": "f46440a4-d930-58d4-b3f5-8110ab846ee3", + "updated_at": "2023-03-26T14:36:08.740618Z", }, }, ), @@ -113,6 +125,18 @@ async def test__search_user_by_other_id__succeed( emails=["ad_user@cts.com"], other_id="some_id", user_kind=UserKinds.CTS_USER, + active=True, + created_at="2023-03-26T14:36:08.740618Z", + cts_id="e0140f4c-4af2-5a2e-9ad1-5f37fceafbaf", + description="Director in Owners dep", + ip_phone=1271020, + manager="Alice", + office="SUN", + other_ip_phone=None, + other_phone=None, + public_name="Bobby", + rts_id="f46440a4-d930-58d4-b3f5-8110ab846ee3", + updated_at="2023-03-26T14:36:08.740618Z", ) assert endpoint.called