1
0
mirror of https://github.com/enpaul/keyosk.git synced 2024-11-05 06:07:06 +00:00
keyosk/tests/test_serializers_domain.py

20 lines
646 B
Python
Raw Permalink Normal View History

# pylint: disable=unused-argument,redefined-outer-name,unused-import
from fixtures import demo_database
from keyosk import database
from keyosk import serializers
def test_compatibility(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)