mirror of
https://github.com/enpaul/keyosk.git
synced 2024-11-24 23:47:49 +00:00
Add tests for account ACL model
Add string repr to account ACL model
This commit is contained in:
parent
54ac7c4141
commit
ae86a5d21c
@ -47,3 +47,6 @@ class AccountACLEntry(KeyoskBaseModel):
|
|||||||
yield "permission", self.permission.name
|
yield "permission", self.permission.name
|
||||||
yield "with_server_secret", self.with_server_secret
|
yield "with_server_secret", self.with_server_secret
|
||||||
yield "with_client_secret", self.with_client_secret
|
yield "with_client_secret", self.with_client_secret
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"ACL {self.permission.name}@{self.access_list.name} (scope:{'+'.join([item for item in ['server' if self.with_server_secret else '', 'client' if self.with_client_secret else ''] if item])})"
|
||||||
|
12
tests/test_database_account_acl.py
Normal file
12
tests/test_database_account_acl.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import json
|
||||||
|
|
||||||
|
import peewee
|
||||||
|
from fixtures import demo_database
|
||||||
|
|
||||||
|
from keyosk import database
|
||||||
|
|
||||||
|
|
||||||
|
def test_formatting(demo_database):
|
||||||
|
for acl in database.AccountACLEntry.select():
|
||||||
|
assert dict(acl) == json.loads(json.dumps(dict(acl)))
|
||||||
|
assert str(acl.uuid) not in str(acl)
|
Loading…
Reference in New Issue
Block a user