Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added manager_huid field into UserFromCSV #474

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pybotx/client/users_api/user_from_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ class BotXAPIUserFromCSVResult(VerifiedPayloadBaseModel):
company: Optional[str] = Field(alias="Company")
department: Optional[str] = Field(alias="Department")
position: Optional[str] = Field(alias="Position")
manager_huid: Optional[UUID] = Field(alias="Manager HUID")

@validator("email", "company", "department", "position", pre=True)
@validator("email", "company", "department", "position", "manager_huid", pre=True)
@classmethod
def replace_empty_string_with_none(cls, field_value: str) -> Optional[str]:
if field_value == "":
Expand All @@ -47,4 +48,5 @@ def to_domain(self) -> UserFromCSV:
company=self.company,
department=self.department,
position=self.position,
manager_huid=self.manager_huid,
)
2 changes: 2 additions & 0 deletions pybotx/models/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class UserFromCSV:
company: User company.
department: User department.
position: User position.
manager_huid: User's manager huid.
"""

huid: UUID
Expand All @@ -62,3 +63,4 @@ class UserFromCSV:
company: Optional[str] = None
department: Optional[str] = None
position: Optional[str] = None
manager_huid: Optional[UUID] = None
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.67.1"
version = "0.68.0"
description = "A python library for interacting with eXpress BotX API"
authors = [
"Sidnev Nikolay <[email protected]>",
Expand Down
16 changes: 9 additions & 7 deletions tests/client/users_api/test_users_as_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ async def test__users_as_csv__succeed(
return_value=httpx.Response(
status_code=HTTPStatus.OK,
content=(
b"HUID,AD Login,Domain,AD E-mail,Name,Sync source,Active,Kind,Company,Department,Position\n"
b"dbc8934f-d0d7-4a9e-89df-d45c137a851c,test_user_17,cts.example.com,,test_user_17,ad,true,cts_user,,,\n"
b"13a6909c-bce1-4dbf-8359-efb7ef8e5b34,test_user_18,cts.example.com,,test_user_18,unsupported,true,cts_user,,,"
b"HUID,AD Login,Domain,AD E-mail,Name,Sync source,Active,Kind,Company,Department,Position,Manager HUID\n"
b"dbc8934f-d0d7-4a9e-89df-d45c137a851c,test_user_17,cts.example.com,,test_user_17,ad,false,cts_user,Company,Department,Position,13a6909c-bce1-4dbf-8359-efb7ef8e5b34\n"
b"13a6909c-bce1-4dbf-8359-efb7ef8e5b34,test_user_18,cts.example.com,,test_user_18,unsupported,true,cts_user,,,,"
),
),
)
Expand All @@ -97,12 +97,13 @@ async def test__users_as_csv__succeed(
ad_domain="cts.example.com",
username="test_user_17",
sync_source=SyncSourceTypes.AD,
active=True,
active=False,
user_kind=UserKinds.CTS_USER,
email=None,
company=None,
department=None,
position=None,
company="Company",
department="Department",
position="Position",
manager_huid=UUID("13a6909c-bce1-4dbf-8359-efb7ef8e5b34"),
),
UserFromCSV(
huid=UUID("13a6909c-bce1-4dbf-8359-efb7ef8e5b34"),
Expand All @@ -116,5 +117,6 @@ async def test__users_as_csv__succeed(
company=None,
department=None,
position=None,
manager_huid=None,
),
]
Loading