move seeds dir

This commit is contained in:
2025-04-03 21:08:59 -03:00
parent 34085af4a8
commit 1358088a48
41 changed files with 1950 additions and 108 deletions

View File

@@ -1,7 +1,13 @@
import json
from http import HTTPMethod, HTTPStatus
from layercake.dynamodb import ComposeKey, DynamoDBCollection, PartitionKey
from layercake.dynamodb import (
ComposeKey,
DynamoDBCollection,
DynamoDBPersistenceLayer,
KeyPair,
PartitionKey,
)
from ..conftest import HttpApiProxy, LambdaContext
@@ -41,4 +47,34 @@ def test_post_course(
)
)
assert len(logs['items']) == 3
print(logs)
def test_put_course(
mock_app,
dynamodb_seeds,
dynamodb_persistence_layer: DynamoDBPersistenceLayer,
http_api_proxy: HttpApiProxy,
lambda_context: LambdaContext,
):
r = mock_app.lambda_handler(
http_api_proxy(
raw_path='/courses/90d7f0d2-d9a4-4467-a31c-f9a7955964cf',
method=HTTPMethod.PUT,
headers={'X-Tenant': '*'},
body={
'id': '90d7f0d2-d9a4-4467-a31c-f9a7955964cf',
'name': 'pytest',
'access_period': YEAR_DAYS,
'cert': {
'exp_interval': YEAR_DAYS * 2,
},
},
),
lambda_context,
)
collect = DynamoDBCollection(dynamodb_persistence_layer)
course = collect.get_item(KeyPair('90d7f0d2-d9a4-4467-a31c-f9a7955964cf', '0'))
print(course)
assert r['statusCode'] == HTTPStatus.OK