2020-03-11 03:29:05 +00:00
|
|
|
# pylint: disable=unused-argument,redefined-outer-name,unused-import
|
|
|
|
from fixtures import demo_database
|
|
|
|
|
|
|
|
from keyosk import database
|
|
|
|
from keyosk import serializers
|
|
|
|
|
|
|
|
|
2020-03-13 02:58:33 +00:00
|
|
|
def test_compatibility(demo_database):
|
2020-03-11 03:29:05 +00:00
|
|
|
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)
|