import datetime import logging import allure import pytest from ui_automation_framework.utils import AppConfig from ui_automation_framework.utils import logger as cl from app.src.api.facade import ApiClient from app.src.helpers.api_data_provider import ApiDataProvider api = ApiClient() api.authorize() data_provider = ApiDataProvider(api) log = cl.Logger(logging.DEBUG) data = data_provider.get_sony_tracks_isrcs(market="us", ignore_response_attaching=True) isrcs = data[0][:20] markets = AppConfig.get("top_markets") @pytest.mark.parametrize("isrc", isrcs) @pytest.mark.parametrize("market", markets) @allure.severity(allure.severity_level.CRITICAL) @allure.title("Rolling week date") @allure.description("Rolling week end date should be the current date") def test_rolling_week(isrc, market): resp_date = api.dsp.get_daily_and_weekly_streams_count("isrc={}".format(isrc), "market={}".format(market))["body"]["dates"]["rolling_week"]["end"] current_date = datetime.datetime.today().strftime("%Y-%m-%d") assert resp_date == current_date, "Dates are matching"