Skip to content

Commit f26033b

Browse files
committed
.
1 parent a6689c0 commit f26033b

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ ignore_missing_imports = true
66
asyncio_mode = "strict"
77
asyncio_default_fixture_loop_scope = "function"
88
addopts = "--ignore=test_build.py"
9+
filterwarnings = [
10+
"ignore::DeprecationWarning:.*datetime.datetime.utcnow.*",
11+
"ignore::DeprecationWarning:.*botocore.*",
12+
]
913

1014
[tool.ruff]
1115

tests/conftest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
from fastapi_users import schemas
66

77
DATABASE_REGION: str = "eu-central-1"
8+
DATABASE_TOKENTABLE_PRIMARY_KEY: str = "token"
9+
DATABASE_USERTABLE_PRIMARY_KEY: str = "id"
810

911

1012
class User(schemas.BaseUser):

tests/tables.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,23 @@
22
import botocore.exceptions
33

44

5-
async def ensure_table_exists(session: aioboto3.Session, table_name: str, region: str):
5+
async def ensure_table_exists(
6+
session: aioboto3.Session,
7+
table_name: str,
8+
primary_key: str,
9+
region: str,
10+
):
611
async with session.client("dynamodb", region_name=region) as client:
712
try:
813
await client.describe_table(TableName=table_name)
914
except botocore.exceptions.ClientError:
1015
await client.create_table(
1116
TableName=table_name,
1217
KeySchema=[
13-
{"AttributeName": "id", "KeyType": "HASH"},
18+
{"AttributeName": primary_key, "KeyType": "HASH"},
1419
],
1520
AttributeDefinitions=[
16-
{"AttributeName": "id", "AttributeType": "S"},
21+
{"AttributeName": primary_key, "AttributeType": "S"},
1722
],
1823
ProvisionedThroughput={"ReadCapacityUnits": 5, "WriteCapacityUnits": 5},
1924
)

0 commit comments

Comments
 (0)