-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconftest.py
23 lines (17 loc) · 865 Bytes
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import uuid
from typing import AsyncGenerator
import pytest_asyncio
from types_aiobotocore_dynamodb import DynamoDBClient
from adapters.dynamodb import create_table
from pessimistic_payments.repository import DynamoDBPaymentIntentRepository
@pytest_asyncio.fixture()
async def dynamodb_table_name(
localstack_dynamodb_client: DynamoDBClient,
) -> AsyncGenerator[str, None]:
table_name = f"autotest-pessimistic-payments-{uuid.uuid4()}"
await create_table(localstack_dynamodb_client, table_name, with_range_key=True)
yield table_name
await localstack_dynamodb_client.delete_table(TableName=table_name)
@pytest_asyncio.fixture()
async def repo(localstack_dynamodb_client: DynamoDBClient, dynamodb_table_name: str) -> DynamoDBPaymentIntentRepository:
return DynamoDBPaymentIntentRepository(localstack_dynamodb_client, dynamodb_table_name)