import pytest import aiosqlite import db @pytest.mark.asyncio async def test_init_db(test_db): # Verify that the table is created cursor = await test_db.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='videos'") table = await cursor.fetchone() assert table is not None assert table["name"] == "videos" @pytest.mark.asyncio async def test_insert_video(test_db): # Insert a video and check constraints/defaults await test_db.execute(""" INSERT INTO videos (video_id, title, url, status) VALUES ('test1234', 'Test Video Title', 'https://www.youtube.com/watch?v=test1234', 'pending') """) await test_db.commit() cursor = await test_db.execute("SELECT * FROM videos WHERE video_id = 'test1234'") video = await cursor.fetchone() assert video is not None assert video["title"] == "Test Video Title" assert video["status"] == "pending" assert video["created_at"] is not None assert video["summary"] is None