"""Smoke: each Yandex scraper instance reads request_delay_sec from scraper_settings."""
from unittest.mock import patch

from app.services.scrapers.yandex_detail import YandexDetailScraper
from app.services.scrapers.yandex_newbuilding import YandexNewbuildingScraper
from app.services.scrapers.yandex_realty import YandexRealtyScraper
from app.services.scrapers.yandex_valuation import YandexValuationScraper


def test_yandex_realty_picks_up_delay():
    with patch("app.services.scrapers.yandex_realty.get_scraper_delay", return_value=9.5):
        s = YandexRealtyScraper()
        assert s.request_delay_sec == 9.5


def test_yandex_detail_picks_up_delay():
    with patch("app.services.scrapers.yandex_detail.get_scraper_delay", return_value=9.5):
        s = YandexDetailScraper()
        assert s.request_delay_sec == 9.5


def test_yandex_newbuilding_picks_up_delay():
    with patch(
        "app.services.scrapers.yandex_newbuilding.get_scraper_delay", return_value=9.5
    ):
        s = YandexNewbuildingScraper()
        assert s.request_delay_sec == 9.5


def test_yandex_valuation_picks_up_delay():
    with patch(
        "app.services.scrapers.yandex_valuation.get_scraper_delay", return_value=9.5
    ):
        s = YandexValuationScraper()
        assert s.request_delay_sec == 9.5
