-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added fields into UserFromSearch: active, created_at, cts_id, d…
…escription, ip_phone, manager, office, other_ip_phone, other_phone, public_name, rts_id, update_at (#483) Co-authored-by: Leonid Gorbunov <leonid.gorbunov@ccsteam.ru>
- Loading branch information
Showing
10 changed files
with
402 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
from typing import Any, Dict | ||
from uuid import UUID | ||
|
||
import pytest | ||
|
||
from pybotx import UserFromSearch, UserKinds | ||
from tests.client.users_api.convert_to_datetime import convert_to_datetime | ||
|
||
|
||
@pytest.fixture() | ||
def user_from_search_with_data_json() -> Dict[str, Any]: | ||
return { | ||
"user_huid": "6fafda2c-6505-57a5-a088-25ea5d1d0364", | ||
"ad_login": "ad_user_login", | ||
"ad_domain": "cts.com", | ||
"name": "Bob", | ||
"company": "Bobs Co", | ||
"company_position": "Director", | ||
"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": 32593, | ||
"other_phone": 1254218, | ||
"public_name": "Bobby", | ||
"rts_id": "f46440a4-d930-58d4-b3f5-8110ab846ee3", | ||
"updated_at": "2023-03-26T14:36:08.740618Z", | ||
} | ||
|
||
|
||
@pytest.fixture | ||
def user_from_search_with_data() -> UserFromSearch: | ||
return UserFromSearch( | ||
huid=UUID("6fafda2c-6505-57a5-a088-25ea5d1d0364"), | ||
ad_login="ad_user_login", | ||
ad_domain="cts.com", | ||
username="Bob", | ||
company="Bobs Co", | ||
company_position="Director", | ||
department="Owners", | ||
emails=["ad_user@cts.com"], | ||
other_id=None, | ||
user_kind=UserKinds.CTS_USER, | ||
active=True, | ||
created_at=convert_to_datetime("2023-03-26T14:36:08.740618Z"), | ||
cts_id=UUID("e0140f4c-4af2-5a2e-9ad1-5f37fceafbaf"), | ||
description="Director in Owners dep", | ||
ip_phone=1271020, | ||
manager="Alice", | ||
office="SUN", | ||
other_ip_phone=32593, | ||
other_phone=1254218, | ||
public_name="Bobby", | ||
rts_id=UUID("f46440a4-d930-58d4-b3f5-8110ab846ee3"), | ||
updated_at=convert_to_datetime("2023-03-26T14:36:08.740618Z"), | ||
) | ||
|
||
|
||
@pytest.fixture | ||
def user_from_search_without_data_json() -> Dict[str, Any]: | ||
return { | ||
"user_huid": "6fafda2c-6505-57a5-a088-25ea5d1d0364", | ||
"ad_login": "ad_user_login", | ||
"ad_domain": "cts.com", | ||
"name": "Bob", | ||
"company": "Bobs Co", | ||
"company_position": "Director", | ||
"department": "Owners", | ||
"emails": ["ad_user@cts.com"], | ||
"user_kind": "cts_user", | ||
"active": None, | ||
"created_at": None, | ||
"cts_id": None, | ||
"description": None, | ||
"ip_phone": None, | ||
"manager": None, | ||
"office": None, | ||
"other_ip_phone": None, | ||
"other_phone": None, | ||
"public_name": None, | ||
"rts_id": None, | ||
"updated_at": None, | ||
} | ||
|
||
|
||
@pytest.fixture | ||
def user_from_search_without_data() -> UserFromSearch: | ||
return UserFromSearch( | ||
huid=UUID("6fafda2c-6505-57a5-a088-25ea5d1d0364"), | ||
ad_login="ad_user_login", | ||
ad_domain="cts.com", | ||
username="Bob", | ||
company="Bobs Co", | ||
company_position="Director", | ||
department="Owners", | ||
emails=["ad_user@cts.com"], | ||
other_id=None, | ||
user_kind=UserKinds.CTS_USER, | ||
active=None, | ||
created_at=None, | ||
cts_id=None, | ||
description=None, | ||
ip_phone=None, | ||
manager=None, | ||
office=None, | ||
other_ip_phone=None, | ||
other_phone=None, | ||
public_name=None, | ||
rts_id=None, | ||
updated_at=None, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from datetime import datetime, timezone | ||
|
||
|
||
def convert_to_datetime(str_datetime: str) -> datetime: | ||
datetime_instance = datetime.strptime( | ||
str_datetime, | ||
"%Y-%m-%dT%H:%M:%S.%fZ", # noqa: WPS325 | ||
) | ||
return datetime_instance.replace(tzinfo=timezone.utc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.