feat: add Kurigram property notification bot
This commit is contained in:
21
tests/test_repository.py
Normal file
21
tests/test_repository.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from property_bot.repository import SubscriptionRepository
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_subscription_lifecycle(tmp_path: Path) -> None:
|
||||
repository = SubscriptionRepository(tmp_path / "subscriptions.sqlite3")
|
||||
await repository.open()
|
||||
try:
|
||||
await repository.activate(100, 200)
|
||||
assert await repository.active_chat_ids() == [100]
|
||||
assert (await repository.get(100)).is_active is True # type: ignore[union-attr]
|
||||
assert await repository.deactivate(100) is True
|
||||
assert await repository.active_chat_ids() == []
|
||||
await repository.activate(100, 201)
|
||||
assert (await repository.get(100)).user_id == 201 # type: ignore[union-attr]
|
||||
finally:
|
||||
await repository.close()
|
||||
Reference in New Issue
Block a user