config/scheme.py: fix detection of extra profiles as 'unknown keys' and add unit test using pickle

This commit is contained in:
InsanePrawn 2022-08-18 05:37:54 +02:00
parent 30d9be0950
commit 91b44299ae
2 changed files with 27 additions and 2 deletions

View file

@ -1,6 +1,7 @@
import pytest
import os
import pickle
import toml
from tempfile import mktemp, gettempdir as get_system_tempdir
@ -168,6 +169,17 @@ def test_config_scheme_modified():
assert c.wrapper.type == 'none'
def test_configstate_profile_pickle():
c = ConfigStateHolder()
assert c.file.wrapper
assert c.file.profiles
# add new profile to check it doesn't error out due to unknown keys
c.file.profiles['graphical'] = {'username': 'kupfer123', 'hostname': 'test123'}
p = pickle.dumps(c)
unpickled = pickle.loads(p)
assert c.file == unpickled.file
def test_profile():
p = None
p = Profile.fromDict(PROFILE_DEFAULTS)