29 lines
903 B
Python
29 lines
903 B
Python
from module_admin.entity.vo.user_vo import CurrentUserModel, UserInfoModel
|
|
from module_business.domain.enums import TestBatchStatus
|
|
from module_business.domain.test_batch_scope import TestBatchScope
|
|
|
|
|
|
def make_current_user(
|
|
user_id: int = 7,
|
|
permissions: list[str] | None = None,
|
|
*,
|
|
admin: bool = False,
|
|
) -> CurrentUserModel:
|
|
return CurrentUserModel(
|
|
permissions=permissions or [],
|
|
roles=[],
|
|
user=UserInfoModel(
|
|
userId=user_id,
|
|
userName='admin' if user_id == 1 else f'user-{user_id}',
|
|
admin=admin,
|
|
),
|
|
)
|
|
|
|
|
|
def make_admin() -> CurrentUserModel:
|
|
return make_current_user(1, ['*:*:*'], admin=True)
|
|
|
|
|
|
def make_test_scope(batch_id: int, status: str = 'ACTIVE', writable: bool = True) -> TestBatchScope:
|
|
return TestBatchScope(batch_id=batch_id, mode='TEST', status=TestBatchStatus(status), writable=writable)
|