Skip to content

Commit

Permalink
Add test case.
Browse files Browse the repository at this point in the history
  • Loading branch information
koval committed May 6, 2024
1 parent ad00826 commit a55e2d0
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions tests/test_entities/test_users_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,34 @@
},
],
}
GET_USERS_RESPONSE_TWO_MEMBERS: Dict[str, Any] = {
"page": 1,
"count": 30,
"total_pages": 1,
"total_items": 2,
"items": [
{
"id": "some_foreign_id_1",
"name": "John Doe",
"email": "[email protected]",
"type": "owner",
"head_id": "user-032044",
"division_ids": ["division-154", "division-871"],
"permissions": ["string"],
"meta": {},
},
{
"id": "some_foreign_id_2",
"name": "Nick Smith",
"email": "[email protected]",
"type": "manager",
"head_id": "user-1234",
"division_ids": ["division-123", "division-321"],
"permissions": ["string"],
"meta": {},
},
],
}
GET_USER_BY_FOREIGN_RESPONSE: Dict[str, Any] = {
"id": FOREIGN_USER_ID,
"name": "John Doe",
Expand Down Expand Up @@ -88,6 +116,20 @@ async def test_get_users_with_foreign(
)
assert response == ForeignUsersListResponse(**GET_USERS_RESPONSE)

httpx_mock.add_response(
url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/users/"
f"foreign?count=30&page=1&member_types=owner&member_types=manager",
json=GET_USERS_RESPONSE_TWO_MEMBERS,
)
api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy)
users_management = UsersManagement(api_client)

response = await users_management.get_users_with_foreign(
account_id=ACCOUNT_ID,
member_types=[MemberType.owner, MemberType.manager],
)
assert response == ForeignUsersListResponse(**GET_USERS_RESPONSE_TWO_MEMBERS)


async def test_get_user_by_foreign(
httpx_mock: HTTPXMock,
Expand Down

0 comments on commit a55e2d0

Please sign in to comment.