From 27ca92ef157e8b174aa68b7548fa80d1893ac2c4 Mon Sep 17 00:00:00 2001 From: Serene-Arc Date: Fri, 22 Jul 2022 17:31:08 +1000 Subject: [PATCH] Add simple test --- tests/test_configuration.py | 9 +++++++++ tests/yaml_test_configuration.yaml | 6 ++++++ 2 files changed, 15 insertions(+) create mode 100644 tests/yaml_test_configuration.yaml diff --git a/tests/test_configuration.py b/tests/test_configuration.py index 8ad1663..6b6cd86 100644 --- a/tests/test_configuration.py +++ b/tests/test_configuration.py @@ -22,3 +22,12 @@ def test_process_click_context(arg_dict: dict): test_config.process_click_arguments(test_context) test_config = vars(test_config) assert all([test_config[arg] == arg_dict[arg] for arg in arg_dict.keys()]) + + +def test_yaml_file_read(): + file = './yaml_test_configuration.yaml' + test_config = Configuration() + test_config.parse_yaml_options(file) + assert test_config.subreddit == ['EarthPorn', 'TwoXChromosomes', 'Mindustry'] + assert test_config.sort == 'new' + assert test_config.limit == 10 diff --git a/tests/yaml_test_configuration.yaml b/tests/yaml_test_configuration.yaml new file mode 100644 index 0000000..5621721 --- /dev/null +++ b/tests/yaml_test_configuration.yaml @@ -0,0 +1,6 @@ +limit: 10 +sort: new +subreddit: + - EarthPorn + - TwoXChromosomes + - Mindustry \ No newline at end of file