"""Test VideoDashboardItem.""" from typing import Any import pytest from sqlalchemy import select from video.connectors import mysql from video.models.sql.classes import video_dashboard_item as video_dashboard_item_class from tests.unit import ar_db_utils @ar_db_utils.test_schema @pytest.mark.parametrize( ( "test_description", "dashboard_item_id", "asset_id", "upc", "expected_response", ), [ ( "test success", 123, 12345, 123456789, { "dashboard_item_id": 123, "asset_id": 12345, "upc": 123456789, }, ), ( "test dashboard item id as None", None, 12345, 123456789, None, ), ], ) def test_video_dashboard_item( test_description: Any, dashboard_item_id: Any, asset_id: Any, upc: Any, expected_response: Any, ) -> None: """Test VideoDashboardItem.""" video_dashboard_item = video_dashboard_item_class.VideoDashboardItem( dashboard_item_id=dashboard_item_id, asset_id=asset_id, upc=upc, ) ar_db_utils.seed_models([video_dashboard_item]) with mysql.ar_db_session() as session: db_result = session.execute( select(video_dashboard_item_class.VideoDashboardItem).where( video_dashboard_item_class.VideoDashboardItem.dashboard_item_id == dashboard_item_id ) ).scalar_one_or_none() query_response = db_result.to_dict() if db_result else None assert query_response == expected_response