bulk-downloader-for-reddit/tests/test_configuration.py
OMEGARAZER 83f45e7f60
Standardize shebang and coding declaration
Standardizes shebang and coding declarations.

Coding matches what's used by install tools such as pip(x).

Removes a few init files that were not needed.
2022-12-19 18:32:37 -05:00

37 lines
952 B
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from unittest.mock import MagicMock
import pytest
from bdfr.configuration import Configuration
@pytest.mark.parametrize(
"arg_dict",
(
{"directory": "test_dir"},
{
"directory": "test_dir",
"no_dupes": True,
},
),
)
def test_process_click_context(arg_dict: dict):
test_config = Configuration()
test_context = MagicMock()
test_context.params = arg_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 = "./tests/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