chdir for tests, test reading mapping

This commit is contained in:
Simon 2024-05-21 22:15:48 +02:00
parent 200f5ed5a2
commit a201d43bfd
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
2 changed files with 19 additions and 0 deletions

View File

@ -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")

View File

@ -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"