# NIKAME GENERATED — DO NOT EDIT DIRECTLY
import pytest
from httpx import AsyncClient
from sqlalchemy.ext.asyncio import AsyncSession


@pytest.mark.asyncio
@pytest.mark.unit
async def test_create_{{ model_name | lower }}(client: AsyncClient, db: AsyncSession):
    """Test creating a new {{ model_name }}."""
    # This is a skeleton test. Refine based on your entity fields.
    data = {
        "name": "Test {{ model_name }}",
        # Add other required fields here
    }
    response = await client.post("/api/v1/{{ model_name | lower }}s/", json=data)
    assert response.status_code == 201
    content = response.json()
    assert content["name"] == data["name"]
    assert "id" in content


@pytest.mark.asyncio
@pytest.mark.unit
async def test_read_{{ model_name | lower }}(client: AsyncClient, db: AsyncSession):
    """Test reading {{ model_name }}."""
    # First create one
    data = {"name": "Read Test"}
    create_resp = await client.post("/api/v1/{{ model_name | lower }}s/", json=data)
    obj_id = create_resp.json()["id"]

    # Now read it
    response = await client.get(f"/api/v1/{{ model_name | lower }}s/{obj_id}")
    assert response.status_code == 200
    assert response.json()["name"] == "Read Test"


@pytest.mark.asyncio
@pytest.mark.unit
async def test_list_{{ model_name | lower }}s(client: AsyncClient, db: AsyncSession):
    """Test listing {{ model_name }} entities."""
    response = await client.get("/api/v1/{{ model_name | lower }}s/")
    assert response.status_code == 200
    assert isinstance(response.json(), list)
