update
This commit is contained in:
@@ -102,3 +102,19 @@ def test_template(
|
||||
lambda_context,
|
||||
)
|
||||
assert r['statusCode'] == HTTPStatus.OK
|
||||
|
||||
|
||||
def test_get_scormset(
|
||||
app,
|
||||
seeds,
|
||||
http_api_proxy: HttpApiProxy,
|
||||
lambda_context: LambdaContext,
|
||||
):
|
||||
r = app.lambda_handler(
|
||||
http_api_proxy(
|
||||
raw_path='/courses/c27d1b4f-575c-4b6b-82a1-9b91ff369e0b/scormset/76c75561-d972-43ef-9818-497d8fc6edbe',
|
||||
method=HTTPMethod.GET,
|
||||
),
|
||||
lambda_context,
|
||||
)
|
||||
assert r['statusCode'] == HTTPStatus.OK
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import json
|
||||
from http import HTTPMethod, HTTPStatus
|
||||
|
||||
from layercake.dynamodb import DynamoDBPersistenceLayer, KeyPair
|
||||
|
||||
from ..conftest import HttpApiProxy, LambdaContext
|
||||
|
||||
|
||||
@@ -22,3 +24,73 @@ def test_get_enrollment(
|
||||
body = json.loads(r['body'])
|
||||
assert 'user' in body
|
||||
assert 'course' in body
|
||||
|
||||
|
||||
def test_get_scormset(
|
||||
app,
|
||||
seeds,
|
||||
http_api_proxy: HttpApiProxy,
|
||||
lambda_context: LambdaContext,
|
||||
):
|
||||
r = app.lambda_handler(
|
||||
http_api_proxy(
|
||||
raw_path='/enrollments/9c166c5e-890f-4e77-9855-769c29aaeb2e/scorm',
|
||||
method=HTTPMethod.GET,
|
||||
),
|
||||
lambda_context,
|
||||
)
|
||||
assert r['statusCode'] == HTTPStatus.OK
|
||||
|
||||
body = json.loads(r['body'])
|
||||
print(body)
|
||||
|
||||
|
||||
def test_post_scormset(
|
||||
app,
|
||||
seeds,
|
||||
dynamodb_persistence_layer: DynamoDBPersistenceLayer,
|
||||
http_api_proxy: HttpApiProxy,
|
||||
lambda_context: LambdaContext,
|
||||
):
|
||||
scormbody = {
|
||||
'suspend_data': '{"v":2,"d":[123,34,112,114,111,103,114,101,115,115,34,58,256,108,263,115,111,110,265,267,34,48,266,256,112,266,49,53,44,34,105,278,276,287,99,281,284,286,275,277,275,290,58,49,125,300,284,49,289,291,285,287,295,256,297,299,302,304,298,125,284,50,313,299,301,34,317,275,293,123,320,51,287,324,320,52,328,278,320,53,332,267,320,54,336,325,315,34,55,340,320,56,345,342,57,348,302,308,306,337,342,49,303,323,333,356,322,256,329,300,365,125],"cpv":"_lnxccXW"}',
|
||||
'launch_data': '',
|
||||
'comments': '',
|
||||
'comments_from_lms': '',
|
||||
'core': {
|
||||
'student_id': '',
|
||||
'student_name': '',
|
||||
'lesson_location': '',
|
||||
'credit': '',
|
||||
'lesson_status': 'incomplete',
|
||||
'entry': '',
|
||||
'lesson_mode': 'normal',
|
||||
'exit': 'suspend',
|
||||
'session_time': '00:00:00',
|
||||
'score': {'raw': '', 'min': '', 'max': '100'},
|
||||
'total_time': '00:00:00',
|
||||
},
|
||||
'objectives': {},
|
||||
'student_data': {
|
||||
'mastery_score': '',
|
||||
'max_time_allowed': '',
|
||||
'time_limit_action': '',
|
||||
},
|
||||
'student_preference': {'audio': '', 'language': '', 'speed': '', 'text': ''},
|
||||
'interactions': {},
|
||||
}
|
||||
|
||||
r = app.lambda_handler(
|
||||
http_api_proxy(
|
||||
raw_path='/enrollments/578ec87f-94c7-4840-8780-bb4839cc7e64',
|
||||
method=HTTPMethod.POST,
|
||||
body=scormbody,
|
||||
),
|
||||
lambda_context,
|
||||
)
|
||||
assert r['statusCode'] == HTTPStatus.NO_CONTENT
|
||||
|
||||
r = dynamodb_persistence_layer.collection.get_item(
|
||||
KeyPair('578ec87f-94c7-4840-8780-bb4839cc7e64', 'SCORM_COMMIT#LAST')
|
||||
)
|
||||
assert r['cmi']['suspend_data'] == scormbody['suspend_data']
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
// Enrollments
|
||||
{"id": "578ec87f-94c7-4840-8780-bb4839cc7e64", "sk": "0", "course": {"id": "af3258f0-bccf-4781-aec6-d4c618d234a7", "name": "pytest", "access_period": 180}, "user": {"id": "068b4600-cc36-4b55-b832-bb620021705a", "name": "Benjamin Burnley", "email": "burnley@breakingbenjamin.com"}}
|
||||
{"id": "9c166c5e-890f-4e77-9855-769c29aaeb2e", "sk": "0", "course": {"id": "c27d1b4f-575c-4b6b-82a1-9b91ff369e0b", "name": "pytest", "access_period": 180, "scormset": "76c75561-d972-43ef-9818-497d8fc6edbe"}, "user": {"id": "068b4600-cc36-4b55-b832-bb620021705a", "name": "Layne Staley", "email": "layne@aliceinchains.com"}}
|
||||
|
||||
// Orgs
|
||||
{"id": "2a8963fc-4694-4fe2-953a-316d1b10f1f5", "sk": "0", "name": "pytest", "cnpj": "04978826000180"}
|
||||
@@ -28,4 +29,7 @@
|
||||
{"id": "cpf", "sk": "07879819908", "user_id": "15bacf02-1535-4bee-9022-19d106fd7518"}
|
||||
|
||||
// Emails
|
||||
{"id": "email", "sk": "sergio@somosbeta.com.br", "user_id": "15bacf02-1535-4bee-9022-19d106fd7518"}
|
||||
{"id": "email", "sk": "sergio@somosbeta.com.br", "user_id": "15bacf02-1535-4bee-9022-19d106fd7518"}
|
||||
|
||||
// Course scormset
|
||||
{"id": "c27d1b4f-575c-4b6b-82a1-9b91ff369e0b", "sk": "SCORMSET#76c75561-d972-43ef-9818-497d8fc6edbe", "packages": [{"version": "1.2", "scormdriver": "s3://saladeaula.digital/scorm/nr-33-espacos-confinados-conteudo-de-demonstracao-scorm12/scormdriver/indexAPI.html"}]}
|
||||
Reference in New Issue
Block a user