From 5bc81f374939de9ec94990745948c3a6db45ee09 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Wed, 12 Sep 2018 21:05:56 +0200 Subject: [PATCH] test importation/exportation with persistent storage --- test/test_storage.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test/test_storage.py b/test/test_storage.py index 54eab0e..c4b5882 100644 --- a/test/test_storage.py +++ b/test/test_storage.py @@ -300,3 +300,31 @@ def test_two_different_information(): delete_session('test_persistent') delete_session('test_persistent2') + + +def test_exportation_importation(): + b = BoolOption('b', '') + o = OptionDescription('od', '', [b]) + try: + c = Config(o, session_id='test_persistent', persistent=True) + d = Config(o, session_id='test_persistent2', persistent=True) + except ValueError: + # storage is not persistent + pass + else: + assert c.option('b').value.get() is None + c.option('b').value.set(True) + assert c.option('b').value.get() is True + del c + # + c = Config(o, session_id='test_persistent', persistent=True) + assert c.value.exportation() == [['b'], [None], [True], ['user']] + d.value.importation(c.value.exportation()) + assert c.value.exportation() == [['b'], [None], [True], ['user']] + assert d.value.exportation() == [['b'], [None], [True], ['user']] + del d + # + d = Config(o, session_id='test_persistent2', persistent=True) + assert d.value.exportation() == [['b'], [None], [True], ['user']] + delete_session('test_persistent') + delete_session('test_persistent2')