56 lines
1.6 KiB
Python
56 lines
1.6 KiB
Python
from typing import Optional, Dict, Any
|
|
from api_objects import OccupantTokenObject, EmployeeTokenObject, UserType
|
|
|
|
|
|
def create_test_occupant_token(
|
|
user_uu_id: str,
|
|
domain: str = "test.com",
|
|
user_id: int = 1,
|
|
person_id: int = 1,
|
|
person_uu_id: str = "test-person",
|
|
credentials: Optional[Dict[str, Any]] = None,
|
|
available_occupants: Optional[Dict[str, Any]] = None,
|
|
) -> OccupantTokenObject:
|
|
"""Create a test occupant token object"""
|
|
return OccupantTokenObject(
|
|
domain=domain,
|
|
user_type=UserType.occupant.value,
|
|
user_uu_id=user_uu_id,
|
|
credentials=credentials or {},
|
|
user_id=user_id,
|
|
person_id=person_id,
|
|
person_uu_id=person_uu_id,
|
|
request={},
|
|
available_occupants=available_occupants or {},
|
|
)
|
|
|
|
|
|
def create_test_employee_token(
|
|
user_uu_id: str,
|
|
domain: str = "test.com",
|
|
user_id: int = 1,
|
|
person_id: int = 1,
|
|
person_uu_id: str = "test-person",
|
|
credentials: Optional[Dict[str, Any]] = None,
|
|
selected_company: Optional[Dict[str, Any]] = None,
|
|
) -> EmployeeTokenObject:
|
|
"""Create a test employee token object"""
|
|
return EmployeeTokenObject(
|
|
domain=domain,
|
|
user_type=UserType.employee.value,
|
|
user_uu_id=user_uu_id,
|
|
credentials=credentials or {},
|
|
user_id=user_id,
|
|
person_id=person_id,
|
|
person_uu_id=person_uu_id,
|
|
request={},
|
|
selected_company=selected_company,
|
|
)
|
|
|
|
|
|
class MockRequest:
|
|
"""Mock request object for testing"""
|
|
|
|
def __init__(self, headers: Optional[Dict[str, str]] = None):
|
|
self.headers = headers or {}
|