-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
125 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import pytest | ||
|
||
from dsp_permissions_scripts.models import group | ||
from dsp_permissions_scripts.models.errors import InvalidGroupError | ||
|
||
|
||
def test_builtin_groups() -> None: | ||
assert group.UNKNOWN_USER == group.Group(val="http://www.knora.org/ontology/knora-admin#UnknownUser") | ||
assert group.KNOWN_USER == group.Group(val="http://www.knora.org/ontology/knora-admin#KnownUser") | ||
assert group.PROJECT_MEMBER == group.Group(val="http://www.knora.org/ontology/knora-admin#ProjectMember") | ||
assert group.PROJECT_ADMIN == group.Group(val="http://www.knora.org/ontology/knora-admin#ProjectAdmin") | ||
assert group.CREATOR == group.Group(val="http://www.knora.org/ontology/knora-admin#Creator") | ||
assert group.SYSTEM_ADMIN == group.Group(val="http://www.knora.org/ontology/knora-admin#SystemAdmin") | ||
|
||
|
||
def test_custom_group() -> None: | ||
group_iri = "http://www.knora.org/ontology/knora-admin#my-custom-group" | ||
custom_group = group.Group(val=group_iri) | ||
assert custom_group.val == group_iri | ||
|
||
|
||
def test_invalid_group() -> None: | ||
with pytest.raises(InvalidGroupError): | ||
group.Group(val="http://www.knora.org/v2/resources/foo") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters