Skip to content

Commit

Permalink
feat: Added fields into UserFromSearch: active, created_at, cts_id, d…
Browse files Browse the repository at this point in the history
…escription, ip_phone, manager, office, other_ip_phone, other_phone, public_name, rts_id, update_at
  • Loading branch information
Leonid Gorbunov committed Jul 29, 2024
1 parent 848971a commit 22721fe
Show file tree
Hide file tree
Showing 8 changed files with 181 additions and 1 deletion.
36 changes: 36 additions & 0 deletions pybotx/client/users_api/user_from_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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,
)


Expand All @@ -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
]
24 changes: 24 additions & 0 deletions pybotx/models/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <nsidnev@ccsteam.ru>",
Expand Down
24 changes: 24 additions & 0 deletions tests/client/users_api/test_search_user_by_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
},
),
Expand All @@ -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
24 changes: 24 additions & 0 deletions tests/client/users_api/test_search_user_by_emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
],
},
Expand Down Expand Up @@ -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
24 changes: 24 additions & 0 deletions tests/client/users_api/test_search_user_by_huid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
},
),
Expand All @@ -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
24 changes: 24 additions & 0 deletions tests/client/users_api/test_search_user_by_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
},
),
Expand Down Expand Up @@ -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
24 changes: 24 additions & 0 deletions tests/client/users_api/test_search_user_by_other_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
},
),
Expand All @@ -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

0 comments on commit 22721fe

Please sign in to comment.