diff --git a/tubearchivist/home/tests/conftest.py b/tubearchivist/home/tests/conftest.py new file mode 100644 index 00000000..5e5cb7f4 --- /dev/null +++ b/tubearchivist/home/tests/conftest.py @@ -0,0 +1,11 @@ +"""test configs""" + +import os + +import pytest + + +@pytest.fixture(scope="session", autouse=True) +def change_test_dir(request): + """change directory to project folder""" + os.chdir(request.config.rootdir / "tubearchivist") diff --git a/tubearchivist/home/tests/test_ta/test_helper.py b/tubearchivist/home/tests/test_ta/test_helper.py index 109f4e56..7c1c4bbf 100644 --- a/tubearchivist/home/tests/test_ta/test_helper.py +++ b/tubearchivist/home/tests/test_ta/test_helper.py @@ -4,6 +4,7 @@ import pytest from home.src.ta.helper import ( date_parser, get_duration_str, + get_mapping, is_shorts, randomizor, time_parser, @@ -80,6 +81,13 @@ def test_time_parser_with_non_numeric_input(): time_parser(timestamp) +def test_get_mapping(): + """test mappint""" + index_config = get_mapping() + assert isinstance(index_config, list) + assert all(isinstance(i, dict) for i in index_config) + + def test_is_shorts(): """is shorts id""" youtube_id = "YG3-Pw3rixU"