mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Implement AWS DynamoDB storage
This commit is contained in:
parent
69c9ecb7e0
commit
51c1bf48e2
3 changed files with 253 additions and 0 deletions
|
|
@ -4,6 +4,7 @@ import pytest_asyncio
|
|||
import aioredis
|
||||
import pytest
|
||||
from _pytest.config import UsageError
|
||||
from aiodynamo.credentials import Key, StaticCredentials
|
||||
|
||||
from aiogram import Bot
|
||||
from . import TOKEN
|
||||
|
|
@ -20,6 +21,11 @@ def pytest_addoption(parser):
|
|||
default=None,
|
||||
help="run tests which require redis connection",
|
||||
)
|
||||
parser.addoption(
|
||||
"--dynamodb",
|
||||
default=None,
|
||||
help="run tests which require dynamodb-local connection",
|
||||
)
|
||||
parser.addini("asyncio_mode", "", default='auto')
|
||||
|
||||
|
||||
|
|
@ -81,6 +87,24 @@ def redis_options(request):
|
|||
raise UsageError("Unsupported aioredis version")
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(scope="session")
|
||||
def dynamodb_options(request):
|
||||
dynamodb_uri = request.config.getoption("--dynamodb")
|
||||
if dynamodb_uri is None:
|
||||
pytest.skip("need --dynamodb option with dynamodb-local URI to run")
|
||||
return
|
||||
return {
|
||||
"credentials": StaticCredentials(
|
||||
Key(
|
||||
"DUMMYIDEXAMPLE",
|
||||
"DUMMYEXAMPLEKEY",
|
||||
)
|
||||
),
|
||||
"region": "dummy-region-1",
|
||||
"endpoint": dynamodb_uri,
|
||||
}
|
||||
|
||||
|
||||
@pytest_asyncio.fixture(name='bot')
|
||||
async def bot_fixture():
|
||||
"""Bot fixture."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue