update url

This commit is contained in:
2025-10-03 21:58:35 -03:00
parent 5ae2128dee
commit b9ac0f1dae
4 changed files with 85 additions and 30 deletions

View File

@@ -1,5 +1,6 @@
from http import HTTPMethod, HTTPStatus
from layercake.dynamodb import DynamoDBPersistenceLayer
from requests_toolbelt import MultipartEncoder
from ..conftest import HttpApiProxy, LambdaContext
@@ -24,14 +25,17 @@ def test_get_course(
def test_edit_course(
app,
seeds,
dynamodb_persistence_layer: DynamoDBPersistenceLayer,
http_api_proxy: HttpApiProxy,
lambda_context: LambdaContext,
):
course_id = '2a8963fc-4694-4fe2-953a-316d1b10f1f5'
with open('tests/sample.html', 'rb') as f:
m = MultipartEncoder(
fields={
'given_cert': 'true',
'name': 'pytest',
'name': 'pytest updated from test',
'access_period': '365',
'cert.exp_interval': '360',
'cert.rawfile': f,
@@ -39,8 +43,8 @@ def test_edit_course(
)
r = app.lambda_handler(
http_api_proxy(
raw_path='/courses/2a8963fc-4694-4fe2-953a-316d1b10f1f5',
method=HTTPMethod.POST,
raw_path=f'/courses/{course_id}',
method=HTTPMethod.PUT,
headers={
'Content-Type': m.content_type,
},
@@ -49,3 +53,10 @@ def test_edit_course(
),
lambda_context,
)
assert r['statusCode'] == HTTPStatus.NO_CONTENT
r = dynamodb_persistence_layer.get_item(
key={'id': course_id, 'sk': '0'},
)
print(r)