From 1e635b6db26713de3be00663b155bb25dd053e00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Tue, 28 Dec 2021 00:26:32 +0200 Subject: [PATCH 1/3] Add config from issue #673 --- tests/mock_data/673-config.json | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tests/mock_data/673-config.json diff --git a/tests/mock_data/673-config.json b/tests/mock_data/673-config.json new file mode 100644 index 0000000000..a777989ced --- /dev/null +++ b/tests/mock_data/673-config.json @@ -0,0 +1,15 @@ +{ + "sync": { + "trakt_to_plex": { + "watched_status": true, + "ratings": false, + "liked_lists": false, + "watchlist": false + }, + "plex_to_trakt": { + "watched_status": true, + "ratings": false, + "collection": false + } + } +} \ No newline at end of file From c1e4394259e6aecb7e93a16bc26c86815b0956e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Tue, 28 Dec 2021 00:26:57 +0200 Subject: [PATCH 2/3] Test config merging for issue #673 --- tests/test_config.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_config.py b/tests/test_config.py index fe97bab798..54d663b84c 100755 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -1,6 +1,8 @@ #!/usr/bin/env python3 -m pytest from os import environ +from os.path import join +from plextraktsync.config import Config from plextraktsync.factory import factory @@ -23,6 +25,14 @@ def test_config_merge(): assert config["root"]["key2"] == "value2" +def test_config_merge_real(): + config = Config() + from tests.conftest import MOCK_DATA_DIR + config.config_file = join(MOCK_DATA_DIR, "673-config.json") + + assert config["sync"]["plex_to_trakt"]["collection"] is False + + def test_config(): config = factory.config() From 734a44b5389ddb9c9ecbcf4309f7e7a85e4f9b35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Tue, 28 Dec 2021 00:33:32 +0200 Subject: [PATCH 3/3] Test config parsing via SyncConfig for issue #673 --- tests/test_config.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_config.py b/tests/test_config.py index 54d663b84c..c66669ce85 100755 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -4,6 +4,7 @@ from plextraktsync.config import Config from plextraktsync.factory import factory +from plextraktsync.sync import SyncConfig def test_config_merge(): @@ -33,6 +34,15 @@ def test_config_merge_real(): assert config["sync"]["plex_to_trakt"]["collection"] is False +def test_sync_config(): + config = Config() + from tests.conftest import MOCK_DATA_DIR + config.config_file = join(MOCK_DATA_DIR, "673-config.json") + + sync_config = SyncConfig(config) + assert sync_config.plex_to_trakt["collection"] is False + + def test_config(): config = factory.config()