This commit is contained in:
2025-10-03 19:31:41 -03:00
parent 48ed8d8345
commit 5ae2128dee
29 changed files with 996 additions and 168 deletions

View File

@@ -0,0 +1,51 @@
from http import HTTPMethod, HTTPStatus
from requests_toolbelt import MultipartEncoder
from ..conftest import HttpApiProxy, LambdaContext
def test_get_course(
app,
seeds,
http_api_proxy: HttpApiProxy,
lambda_context: LambdaContext,
):
r = app.lambda_handler(
http_api_proxy(
raw_path='/courses/2a8963fc-4694-4fe2-953a-316d1b10f1f5',
method=HTTPMethod.GET,
),
lambda_context,
)
assert r['statusCode'] == HTTPStatus.OK
def test_edit_course(
app,
seeds,
http_api_proxy: HttpApiProxy,
lambda_context: LambdaContext,
):
with open('tests/sample.html', 'rb') as f:
m = MultipartEncoder(
fields={
'given_cert': 'true',
'name': 'pytest',
'access_period': '365',
'cert.exp_interval': '360',
'cert.rawfile': f,
}
)
r = app.lambda_handler(
http_api_proxy(
raw_path='/courses/2a8963fc-4694-4fe2-953a-316d1b10f1f5',
method=HTTPMethod.POST,
headers={
'Content-Type': m.content_type,
},
body=m.to_string().decode(),
is_base64_encoded=True,
),
lambda_context,
)