-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update pytest-asyncio because it was unable to find the event loop for new tests, see pytest-dev/pytest-asyncio#862
- Loading branch information
1 parent
d7ad5c9
commit f03d3a0
Showing
3 changed files
with
55 additions
and
1 deletion.
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
Empty file.
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,51 @@ | ||
from goosebit.auth import compare_permission, compare_permissions | ||
|
||
|
||
def test_compare_single_permission(): | ||
assert compare_permission("home.read", "home.read") | ||
|
||
|
||
def test_compare_inverted_single_permission(): | ||
assert not compare_permission("home.read", "!home.read") | ||
|
||
|
||
def test_compare_wildcard_sub_permission(): | ||
assert compare_permission("home.read", "home.*") | ||
|
||
|
||
def test_compare_inverted_wildcard_sub_permission(): | ||
assert not compare_permission("home.read", "!home.*") | ||
|
||
|
||
def test_compare_root_permission(): | ||
assert compare_permission("home.read", "home") | ||
|
||
|
||
def test_compare_inverted_root_permission(): | ||
assert not compare_permission("home.read", "!home") | ||
|
||
|
||
def test_compare_root_wildcard_permission(): | ||
assert compare_permission("home.read", "*") | ||
|
||
|
||
def test_compare_inverted_root_wildcard_permission(): | ||
assert not compare_permission("home.read", "!*") | ||
|
||
|
||
def test_compare_multiple_single_permissions(): | ||
assert compare_permissions(["home.read", "device.write"], ["home.read", "device.write"]) | ||
|
||
|
||
def test_compare_invalid_multiple_single_permissions(): | ||
assert not compare_permissions(["home.read", "device.write"], ["home.read", "device.read"]) | ||
|
||
|
||
def test_compare_inverted_multiple_permissions(): | ||
assert not compare_permissions(["home.read", "device.write"], ["home.read", "device", "!device.write"]) | ||
|
||
|
||
def test_compare_multiple_root_wildcard_permissions(): | ||
assert compare_permissions( | ||
["home.read", "device.write", "device.read", "software.read"], ["*.read", "device.write"] | ||
) |