Add domain tests for all of authz

This commit is contained in:
richard-dds
2018-07-30 15:31:14 -04:00
committed by dandds
parent e270350925
commit 08243a199a
2 changed files with 95 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
import pytest
from atst.domain.roles import Roles
from atst.domain.exceptions import NotFoundError
@pytest.fixture()
def roles_repo(db):
return Roles(db)
def test_get_all_roles(roles_repo):
roles = roles_repo.get_all()
assert roles
def test_get_existing_role(roles_repo):
role = roles_repo.get("developer")
assert role.name == "developer"
def test_get_nonexistent_role(roles_repo):
with pytest.raises(NotFoundError):
roles_repo.get("nonexistent")