mirror of
https://github.com/enpaul/keyosk.git
synced 2024-11-05 06:07:06 +00:00
Ethan Paul
f59afcccf7
Fix dumping and loading compatibility of domain model Fix (untested) dumping and loading compatibility of account model Loosen simple name regex requirements
21 lines
656 B
Python
21 lines
656 B
Python
# pylint: disable=unused-argument,redefined-outer-name,unused-import
|
|
import pytest
|
|
from fixtures import demo_database
|
|
|
|
from keyosk import database
|
|
from keyosk import serializers
|
|
|
|
|
|
def test_roundtrip(demo_database):
|
|
serializer = serializers.DomainSerializer()
|
|
|
|
for domain in database.KeyoskDomain.select():
|
|
dumped = serializer.dump(domain)
|
|
assert sorted(dumped["permissions"]) == sorted(
|
|
[permission.name for permission in domain.permissions]
|
|
)
|
|
assert sorted(dumped["access-lists"]) == sorted(
|
|
acl.name for acl in domain.access_lists
|
|
)
|
|
assert domain == serializer.load(dumped)
|