mirror of
https://github.com/enpaul/keyosk.git
synced 2025-09-18 21:51:57 +00:00
Add tests for account serializer
Fix bugs with account scope de/serializing Fix bugs with domain serializer tests Fix bugs with database account tests
This commit is contained in:
@@ -10,9 +10,15 @@ from keyosk import database
|
||||
|
||||
|
||||
def test_formatting(demo_database):
|
||||
for account in database.KeyoskAccount.select():
|
||||
for account in (
|
||||
database.KeyoskAccount.select().join(database.KeyoskAccountScope).select()
|
||||
):
|
||||
assert str(account.uuid) in str(account)
|
||||
assert account.username in str(account)
|
||||
for scope in account.scopes:
|
||||
assert str(scope.uuid) not in str(scope)
|
||||
assert scope.permission.name in str(scope)
|
||||
assert scope.access_list.name in str(scope)
|
||||
|
||||
|
||||
def test_extras(demo_database):
|
||||
|
13
tests/test_serializers_account.py
Normal file
13
tests/test_serializers_account.py
Normal file
@@ -0,0 +1,13 @@
|
||||
# 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.AccountSerializer()
|
||||
|
||||
for domain in database.KeyoskAccount.select():
|
||||
dumped = serializer.dump(domain)
|
||||
assert domain == serializer.load(dumped)
|
@@ -1,12 +1,11 @@
|
||||
# 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):
|
||||
def test_compatibility(demo_database):
|
||||
serializer = serializers.DomainSerializer()
|
||||
|
||||
for domain in database.KeyoskDomain.select():
|
||||
|
Reference in New Issue
Block a user