test: Add comprehensive test suite for extract.py (#400)

This commit is contained in:
1cu
2025-02-05 23:35:45 +01:00
committed by GitHub
parent 08197eabae
commit f4f00b9563
4 changed files with 723 additions and 60 deletions

View File

@@ -4,9 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-or-later
SPDX-ArtifactOfProjectHomePage: https://github.com/Second-Hand-Friends/kleinanzeigen-bot/
"""
import logging
from typing import Any, Final
import pytest
from typing import Final
from kleinanzeigen_bot import utils
from kleinanzeigen_bot.i18n import get_translating_logger
@@ -15,49 +13,3 @@ utils.configure_console_logging()
LOG:Final[logging.Logger] = get_translating_logger("kleinanzeigen_bot")
LOG.setLevel(logging.DEBUG)
@pytest.fixture
def sample_config() -> dict[str, Any]:
return {
"login": {
"username": "test_user",
"password": "test_password"
},
"browser": {
"arguments": [],
"binary_location": None,
"extensions": [],
"use_private_window": True,
"user_data_dir": None,
"profile_name": None
},
"ad_defaults": {
"description": {
"prefix": "",
"suffix": ""
}
},
"ad_files": ["ads/*.yaml"]
}
@pytest.fixture
def sample_ad_config() -> dict[str, Any]:
return {
"title": "Test Item",
"description": "Test Description",
"price": "100",
"price_type": "FIXED",
"shipping_type": "PICKUP",
"active": True,
"contact": {
"name": "Test User",
"zipcode": "12345"
},
"images": [],
"id": None,
"created_on": None,
"updated_on": None,
"republication_interval": 30
}