implement PermissionSets.get_many for getting multiple permission sets by name
This commit is contained in:
32
tests/domain/test_permission_sets.py
Normal file
32
tests/domain/test_permission_sets.py
Normal file
@@ -0,0 +1,32 @@
|
||||
import pytest
|
||||
from atst.domain.permission_sets import PermissionSets
|
||||
from atst.domain.exceptions import NotFoundError
|
||||
from atst.utils import first_or_none
|
||||
|
||||
|
||||
def test_get_all():
|
||||
roles = PermissionSets.get_all()
|
||||
assert roles
|
||||
|
||||
|
||||
def test_get_existing_permission_set():
|
||||
role = PermissionSets.get("portfolio_poc")
|
||||
assert role.name == "portfolio_poc"
|
||||
|
||||
|
||||
def test_get_nonexistent_permission_set():
|
||||
with pytest.raises(NotFoundError):
|
||||
PermissionSets.get("nonexistent")
|
||||
|
||||
|
||||
def test_get_many():
|
||||
perms_sets = PermissionSets.get_many(
|
||||
[PermissionSets.VIEW_PORTFOLIO_FUNDING, PermissionSets.EDIT_PORTFOLIO_FUNDING]
|
||||
)
|
||||
assert len(perms_sets) == 2
|
||||
assert first_or_none(
|
||||
lambda p: p.name == PermissionSets.VIEW_PORTFOLIO_FUNDING, perms_sets
|
||||
)
|
||||
assert first_or_none(
|
||||
lambda p: p.name == PermissionSets.EDIT_PORTFOLIO_FUNDING, perms_sets
|
||||
)
|
Reference in New Issue
Block a user