зеркало из
https://github.com/viginum-datalab/twscrape.git
synced 2025-10-29 21:16:25 +02:00
32 строки
898 B
Python
32 строки
898 B
Python
import pytest
|
|
|
|
from twscrape.accounts_pool import AccountsPool
|
|
from twscrape.api import API
|
|
from twscrape.queue_client import QueueClient
|
|
|
|
|
|
@pytest.fixture
|
|
def pool_mock(tmp_path) -> AccountsPool: # type: ignore
|
|
db_path = tmp_path / "test.db"
|
|
yield AccountsPool(db_path)
|
|
|
|
|
|
@pytest.fixture
|
|
async def client_fixture(pool_mock: AccountsPool):
|
|
await pool_mock.add_account("user1", "pass1", "email1", "email_pass1")
|
|
await pool_mock.add_account("user2", "pass2", "email2", "email_pass2")
|
|
await pool_mock.set_active("user1", True)
|
|
await pool_mock.set_active("user2", True)
|
|
|
|
client = QueueClient(pool_mock, "SearchTimeline")
|
|
yield pool_mock, client
|
|
|
|
|
|
@pytest.fixture
|
|
async def api_mock(pool_mock: AccountsPool):
|
|
await pool_mock.add_account("user1", "pass1", "email1", "email_pass1")
|
|
await pool_mock.set_active("user1", True)
|
|
|
|
api = API(pool_mock)
|
|
yield api
|