19 lines
571 B
Python
19 lines
571 B
Python
import asyncio
|
|
|
|
import pytest
|
|
|
|
from app.models import MonitorCreate
|
|
from app.store import MonitorStore
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_concurrent_creates_are_retained_and_results_are_copies() -> None:
|
|
state = MonitorStore()
|
|
payload = MonitorCreate(name="same", url="https://example.com")
|
|
created = await asyncio.gather(*(state.create(payload) for _ in range(25)))
|
|
assert len(await state.list()) == 25
|
|
created[0].name = "mutated"
|
|
persisted = await state.get(created[0].id)
|
|
assert persisted is not None
|
|
assert persisted.name == "same"
|