31 lines
934 B
Python
31 lines
934 B
Python
import pytest
|
|
from sqlalchemy import text
|
|
|
|
from app.database.session import AsyncSessionLocal, engine
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_database_connection():
|
|
"""데이터베이스 연결 테스트"""
|
|
async with engine.begin() as connection:
|
|
result = await connection.execute(text("SELECT 1"))
|
|
assert result.scalar() == 1
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_session_creation():
|
|
"""세션 생성 테스트"""
|
|
async with AsyncSessionLocal() as session:
|
|
result = await session.execute(text("SELECT 1"))
|
|
assert result.scalar() == 1
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_database_version():
|
|
"""MySQL 버전 확인 테스트"""
|
|
async with AsyncSessionLocal() as session:
|
|
result = await session.execute(text("SELECT VERSION()"))
|
|
version = result.scalar()
|
|
assert version is not None
|
|
print(f"MySQL Version: {version}")
|