From 5452d0f566494e60abfc971e4704a34dbbc03e7d Mon Sep 17 00:00:00 2001 From: Jillian Vogel Date: Tue, 25 Jul 2023 18:45:10 +0930 Subject: [PATCH] test: adds tests for problem_check event with multiple questions Expected fixtures record the current behavior --- ...ck(server,multiple_questions,correct).json | 160 ++++++++++++++++++ ...(server,multiple_questions,incorrect).json | 127 ++++++++++++++ ...r,multiple_questions,partial_correct).json | 159 +++++++++++++++++ ...ck(server,multiple_questions,correct).json | 45 +++++ ...(server,multiple_questions,incorrect).json | 45 +++++ ...multiple_questions,partially_correct).json | 45 +++++ 6 files changed, 581 insertions(+) create mode 100644 event_routing_backends/processors/tests/fixtures/current/problem_check(server,multiple_questions,correct).json create mode 100644 event_routing_backends/processors/tests/fixtures/current/problem_check(server,multiple_questions,incorrect).json create mode 100644 event_routing_backends/processors/tests/fixtures/current/problem_check(server,multiple_questions,partial_correct).json create mode 100644 event_routing_backends/processors/xapi/tests/fixtures/expected/problem_check(server,multiple_questions,correct).json create mode 100644 event_routing_backends/processors/xapi/tests/fixtures/expected/problem_check(server,multiple_questions,incorrect).json create mode 100644 event_routing_backends/processors/xapi/tests/fixtures/expected/problem_check(server,multiple_questions,partially_correct).json diff --git a/event_routing_backends/processors/tests/fixtures/current/problem_check(server,multiple_questions,correct).json b/event_routing_backends/processors/tests/fixtures/current/problem_check(server,multiple_questions,correct).json new file mode 100644 index 00000000..599500ea --- /dev/null +++ b/event_routing_backends/processors/tests/fixtures/current/problem_check(server,multiple_questions,correct).json @@ -0,0 +1,160 @@ +{ + "name":"problem_check", + "context":{ + "course_id":"course-v1:edX+DemoX+Demo_Course", + "course_user_tags":{ + + }, + "user_id":8, + "path":"/courses/course-v1:edX+DemoX+Demo_Course/xblock/block-v1:edX+DemoX+Demo_Course+type@problem+block@a0effb954cca4759994f1ac9e9434bf4/handler/xmodule_handler/problem_check", + "org_id":"edX", + "enterprise_uuid":"", + "module":{ + "display_name":"Multiple Choice Questions", + "usage_key":"block-v1:edX+DemoX+Demo_Course+type@problem+block@a0effb954cca4759994f1ac9e9434bf4" + }, + "asides":{ + + } + }, + "username":"staff", + "session":"97662bef7c463c187b8fd91e0f580468", + "ip":"172.18.0.1", + "agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0", + "host":"localhost:18000", + "referer":"http://localhost:18000/xblock/block-v1:edX+DemoX+Demo_Course+type@vertical+block@54bb9b142c6c4c22afc62bcb628f0e68?exam_access=&format=Homework&recheck_access=1&show_bookmark=0&show_title=0&view=student_view", + "accept_language":"en-US,en;q=0.5", + "event":{ + "state":{ + "seed":1, + "student_answers":{ + "a0effb954cca4759994f1ac9e9434bf4_2_1":"blue", + "a0effb954cca4759994f1ac9e9434bf4_4_1":[ + "choice_0", + "choice_2" + ], + "a0effb954cca4759994f1ac9e9434bf4_3_1":"choice_3" + }, + "has_saved_answers":false, + "correct_map":{ + "a0effb954cca4759994f1ac9e9434bf4_2_1":{ + "correctness":"correct", + "npoints":null, + "msg":"", + "hint":"", + "hintmode":null, + "queuestate":null, + "answervariable":null + }, + "a0effb954cca4759994f1ac9e9434bf4_3_1":{ + "correctness":"incorrect", + "npoints":null, + "msg":"", + "hint":"", + "hintmode":null, + "queuestate":null, + "answervariable":null + }, + "a0effb954cca4759994f1ac9e9434bf4_4_1":{ + "correctness":"correct", + "npoints":null, + "msg":"", + "hint":"", + "hintmode":null, + "queuestate":null, + "answervariable":null + } + }, + "input_state":{ + "a0effb954cca4759994f1ac9e9434bf4_2_1":{ + + }, + "a0effb954cca4759994f1ac9e9434bf4_3_1":{ + + }, + "a0effb954cca4759994f1ac9e9434bf4_4_1":{ + + } + }, + "done":true + }, + "problem_id":"block-v1:edX+DemoX+Demo_Course+type@problem+block@a0effb954cca4759994f1ac9e9434bf4", + "answers":{ + "a0effb954cca4759994f1ac9e9434bf4_2_1":"blue", + "a0effb954cca4759994f1ac9e9434bf4_4_1":[ + "choice_0", + "choice_2" + ], + "a0effb954cca4759994f1ac9e9434bf4_3_1":"choice_2" + }, + "grade":3, + "max_grade":3, + "correct_map":{ + "a0effb954cca4759994f1ac9e9434bf4_2_1":{ + "correctness":"correct", + "npoints":null, + "msg":"", + "hint":"", + "hintmode":null, + "queuestate":null, + "answervariable":null + }, + "a0effb954cca4759994f1ac9e9434bf4_3_1":{ + "correctness":"correct", + "npoints":null, + "msg":"", + "hint":"", + "hintmode":null, + "queuestate":null, + "answervariable":null + }, + "a0effb954cca4759994f1ac9e9434bf4_4_1":{ + "correctness":"correct", + "npoints":null, + "msg":"", + "hint":"", + "hintmode":null, + "queuestate":null, + "answervariable":null + } + }, + "success":"correct", + "attempts":3, + "submission":{ + "a0effb954cca4759994f1ac9e9434bf4_2_1":{ + "question":"", + "answer":"blue", + "response_type":"optionresponse", + "input_type":"optioninput", + "correct":true, + "variant":"", + "group_label":"" + }, + "a0effb954cca4759994f1ac9e9434bf4_4_1":{ + "question":"", + "answer":[ + "a piano", + "a guitar" + ], + "response_type":"choiceresponse", + "input_type":"checkboxgroup", + "correct":true, + "variant":"", + "group_label":"" + }, + "a0effb954cca4759994f1ac9e9434bf4_3_1":{ + "question":"", + "answer":"a chair", + "response_type":"multiplechoiceresponse", + "input_type":"choicegroup", + "correct":true, + "variant":"", + "group_label":"" + } + } + }, + "time":"2023-08-03T06:32:31.431355+00:00", + "event_type":"problem_check", + "event_source":"server", + "page":"x_module" +} diff --git a/event_routing_backends/processors/tests/fixtures/current/problem_check(server,multiple_questions,incorrect).json b/event_routing_backends/processors/tests/fixtures/current/problem_check(server,multiple_questions,incorrect).json new file mode 100644 index 00000000..fc21658e --- /dev/null +++ b/event_routing_backends/processors/tests/fixtures/current/problem_check(server,multiple_questions,incorrect).json @@ -0,0 +1,127 @@ +{ + "name":"problem_check", + "context":{ + "course_id":"course-v1:edX+DemoX+Demo_Course", + "course_user_tags":{ + + }, + "user_id":8, + "path":"/courses/course-v1:edX+DemoX+Demo_Course/xblock/block-v1:edX+DemoX+Demo_Course+type@problem+block@a0effb954cca4759994f1ac9e9434bf4/handler/xmodule_handler/problem_check", + "org_id":"edX", + "enterprise_uuid":"", + "module":{ + "display_name":"Multiple Choice Questions", + "usage_key":"block-v1:edX+DemoX+Demo_Course+type@problem+block@a0effb954cca4759994f1ac9e9434bf4" + }, + "asides":{ + + } + }, + "username":"staff", + "session":"97662bef7c463c187b8fd91e0f580468", + "ip":"172.18.0.1", + "agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0", + "host":"localhost:18000", + "referer":"http://localhost:18000/xblock/block-v1:edX+DemoX+Demo_Course+type@vertical+block@54bb9b142c6c4c22afc62bcb628f0e68?exam_access=&format=Homework&recheck_access=1&show_bookmark=0&show_title=0&view=student_view", + "accept_language":"en-US,en;q=0.5", + "event":{ + "state":{ + "seed":1, + "student_answers":{ + + }, + "has_saved_answers":false, + "correct_map":{ + + }, + "input_state":{ + "a0effb954cca4759994f1ac9e9434bf4_2_1":{ + + }, + "a0effb954cca4759994f1ac9e9434bf4_3_1":{ + + }, + "a0effb954cca4759994f1ac9e9434bf4_4_1":{ + + } + }, + "done":false + }, + "problem_id":"block-v1:edX+DemoX+Demo_Course+type@problem+block@a0effb954cca4759994f1ac9e9434bf4", + "answers":{ + "a0effb954cca4759994f1ac9e9434bf4_2_1":"yellow", + "a0effb954cca4759994f1ac9e9434bf4_4_1":[ + "choice_3" + ], + "a0effb954cca4759994f1ac9e9434bf4_3_1":"choice_3" + }, + "grade":0, + "max_grade":3, + "correct_map":{ + "a0effb954cca4759994f1ac9e9434bf4_2_1":{ + "correctness":"incorrect", + "npoints":null, + "msg":"", + "hint":"", + "hintmode":null, + "queuestate":null, + "answervariable":null + }, + "a0effb954cca4759994f1ac9e9434bf4_3_1":{ + "correctness":"incorrect", + "npoints":null, + "msg":"", + "hint":"", + "hintmode":null, + "queuestate":null, + "answervariable":null + }, + "a0effb954cca4759994f1ac9e9434bf4_4_1":{ + "correctness":"incorrect", + "npoints":null, + "msg":"", + "hint":"", + "hintmode":null, + "queuestate":null, + "answervariable":null + } + }, + "success":"incorrect", + "attempts":1, + "submission":{ + "a0effb954cca4759994f1ac9e9434bf4_2_1":{ + "question":"", + "answer":"yellow", + "response_type":"optionresponse", + "input_type":"optioninput", + "correct":false, + "variant":"", + "group_label":"" + }, + "a0effb954cca4759994f1ac9e9434bf4_4_1":{ + "question":"", + "answer":[ + "a window" + ], + "response_type":"choiceresponse", + "input_type":"checkboxgroup", + "correct":false, + "variant":"", + "group_label":"" + }, + "a0effb954cca4759994f1ac9e9434bf4_3_1":{ + "question":"", + "answer":"a bookshelf", + "response_type":"multiplechoiceresponse", + "input_type":"choicegroup", + "correct":false, + "variant":"", + "group_label":"" + } + } + }, + "time":"2023-08-03T06:30:32.026903+00:00", + "event_type":"problem_check", + "event_source":"server", + "page":"x_module" +} diff --git a/event_routing_backends/processors/tests/fixtures/current/problem_check(server,multiple_questions,partial_correct).json b/event_routing_backends/processors/tests/fixtures/current/problem_check(server,multiple_questions,partial_correct).json new file mode 100644 index 00000000..da862598 --- /dev/null +++ b/event_routing_backends/processors/tests/fixtures/current/problem_check(server,multiple_questions,partial_correct).json @@ -0,0 +1,159 @@ +{ + "name":"problem_check", + "context":{ + "course_id":"course-v1:edX+DemoX+Demo_Course", + "course_user_tags":{ + + }, + "user_id":8, + "path":"/courses/course-v1:edX+DemoX+Demo_Course/xblock/block-v1:edX+DemoX+Demo_Course+type@problem+block@a0effb954cca4759994f1ac9e9434bf4/handler/xmodule_handler/problem_check", + "org_id":"edX", + "enterprise_uuid":"", + "module":{ + "display_name":"Multiple Choice Questions", + "usage_key":"block-v1:edX+DemoX+Demo_Course+type@problem+block@a0effb954cca4759994f1ac9e9434bf4" + }, + "asides":{ + + } + }, + "username":"staff", + "session":"2c65c4e9e6a637feb42426fd35b5dac3", + "ip":"172.18.0.1", + "agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0", + "host":"localhost:18000", + "referer":"http://localhost:18000/xblock/block-v1:edX+DemoX+Demo_Course+type@vertical+block@54bb9b142c6c4c22afc62bcb628f0e68?exam_access=&format=Homework&recheck_access=1&show_bookmark=0&show_title=0&view=student_view", + "accept_language":"en-US,en;q=0.5", + "event":{ + "state":{ + "seed":1, + "student_answers":{ + "a0effb954cca4759994f1ac9e9434bf4_2_1":"yellow", + "a0effb954cca4759994f1ac9e9434bf4_4_1":[ + "choice_3" + ], + "a0effb954cca4759994f1ac9e9434bf4_3_1":"choice_3" + }, + "has_saved_answers":false, + "correct_map":{ + "a0effb954cca4759994f1ac9e9434bf4_2_1":{ + "correctness":"incorrect", + "npoints":null, + "msg":"", + "hint":"", + "hintmode":null, + "queuestate":null, + "answervariable":null + }, + "a0effb954cca4759994f1ac9e9434bf4_3_1":{ + "correctness":"incorrect", + "npoints":null, + "msg":"", + "hint":"", + "hintmode":null, + "queuestate":null, + "answervariable":null + }, + "a0effb954cca4759994f1ac9e9434bf4_4_1":{ + "correctness":"incorrect", + "npoints":null, + "msg":"", + "hint":"", + "hintmode":null, + "queuestate":null, + "answervariable":null + } + }, + "input_state":{ + "a0effb954cca4759994f1ac9e9434bf4_2_1":{ + + }, + "a0effb954cca4759994f1ac9e9434bf4_3_1":{ + + }, + "a0effb954cca4759994f1ac9e9434bf4_4_1":{ + + } + }, + "done":true + }, + "problem_id":"block-v1:edX+DemoX+Demo_Course+type@problem+block@a0effb954cca4759994f1ac9e9434bf4", + "answers":{ + "a0effb954cca4759994f1ac9e9434bf4_2_1":"blue", + "a0effb954cca4759994f1ac9e9434bf4_4_1":[ + "choice_0", + "choice_2" + ], + "a0effb954cca4759994f1ac9e9434bf4_3_1":"choice_3" + }, + "grade":2, + "max_grade":3, + "correct_map":{ + "a0effb954cca4759994f1ac9e9434bf4_2_1":{ + "correctness":"correct", + "npoints":null, + "msg":"", + "hint":"", + "hintmode":null, + "queuestate":null, + "answervariable":null + }, + "a0effb954cca4759994f1ac9e9434bf4_3_1":{ + "correctness":"incorrect", + "npoints":null, + "msg":"", + "hint":"", + "hintmode":null, + "queuestate":null, + "answervariable":null + }, + "a0effb954cca4759994f1ac9e9434bf4_4_1":{ + "correctness":"correct", + "npoints":null, + "msg":"", + "hint":"", + "hintmode":null, + "queuestate":null, + "answervariable":null + } + }, + "success":"incorrect", + "attempts":2, + "submission":{ + "a0effb954cca4759994f1ac9e9434bf4_2_1":{ + "question":"", + "answer":"blue", + "response_type":"optionresponse", + "input_type":"optioninput", + "correct":true, + "variant":"", + "group_label":"" + }, + "a0effb954cca4759994f1ac9e9434bf4_4_1":{ + "question":"", + "answer":[ + "a piano", + "a guitar" + ], + "response_type":"choiceresponse", + "input_type":"checkboxgroup", + "correct":true, + "variant":"", + "group_label":"" + }, + "a0effb954cca4759994f1ac9e9434bf4_3_1":{ + "question":"", + "answer":"a bookshelf", + "response_type":"multiplechoiceresponse", + "input_type":"choicegroup", + "correct":false, + "variant":"", + "group_label":"" + } + } + }, + "time":"2023-08-03T06:31:39.005451+00:00", + "event_type":"problem_check", + "event_source":"server", + "page":"x_module" +} diff --git a/event_routing_backends/processors/xapi/tests/fixtures/expected/problem_check(server,multiple_questions,correct).json b/event_routing_backends/processors/xapi/tests/fixtures/expected/problem_check(server,multiple_questions,correct).json new file mode 100644 index 00000000..f3fe2a7b --- /dev/null +++ b/event_routing_backends/processors/xapi/tests/fixtures/expected/problem_check(server,multiple_questions,correct).json @@ -0,0 +1,45 @@ +{ + "id": "6d1f033b-3f70-458c-b53a-e6bb63cbaef9", + "result": {"score": {"min": 0.0}, "success": false}, + "version": "1.0.3", + "actor": { + "objectType": "Agent", + "account": { + "name": "32e08e30-f8ae-4ce2-94a8-c2bfe38a70cb", + "homePage": "http://localhost:18000" + } + }, + "verb": { + "id": "https://w3id.org/xapi/acrossx/verbs/evaluated", + "display": { + "en": "evaluated" + } + }, + "object": { + "objectType": "Activity", + "definition": { + "type": "http://adlnet.gov/expapi/activities/cmi.interaction", + "interactionType": "choice" + } + }, + "context": { + "contextActivities": { + "parent": [ + { + "id": "http://localhost:18000/course/course-v1:edX+DemoX+Demo_Course", + "objectType": "Activity", + "definition": { + "name": { + "en-US": "Demonstration Course" + }, + "type": "http://adlnet.gov/expapi/activities/course" + } + } + ] + }, + "extensions": { + "https://w3id.org/xapi/openedx/extension/transformer-version": "event-routing-backends@1.1.1", + "https://w3id.org/xapi/openedx/extensions/session-id": "97662bef7c463c187b8fd91e0f580468" + } + } +} diff --git a/event_routing_backends/processors/xapi/tests/fixtures/expected/problem_check(server,multiple_questions,incorrect).json b/event_routing_backends/processors/xapi/tests/fixtures/expected/problem_check(server,multiple_questions,incorrect).json new file mode 100644 index 00000000..f3fe2a7b --- /dev/null +++ b/event_routing_backends/processors/xapi/tests/fixtures/expected/problem_check(server,multiple_questions,incorrect).json @@ -0,0 +1,45 @@ +{ + "id": "6d1f033b-3f70-458c-b53a-e6bb63cbaef9", + "result": {"score": {"min": 0.0}, "success": false}, + "version": "1.0.3", + "actor": { + "objectType": "Agent", + "account": { + "name": "32e08e30-f8ae-4ce2-94a8-c2bfe38a70cb", + "homePage": "http://localhost:18000" + } + }, + "verb": { + "id": "https://w3id.org/xapi/acrossx/verbs/evaluated", + "display": { + "en": "evaluated" + } + }, + "object": { + "objectType": "Activity", + "definition": { + "type": "http://adlnet.gov/expapi/activities/cmi.interaction", + "interactionType": "choice" + } + }, + "context": { + "contextActivities": { + "parent": [ + { + "id": "http://localhost:18000/course/course-v1:edX+DemoX+Demo_Course", + "objectType": "Activity", + "definition": { + "name": { + "en-US": "Demonstration Course" + }, + "type": "http://adlnet.gov/expapi/activities/course" + } + } + ] + }, + "extensions": { + "https://w3id.org/xapi/openedx/extension/transformer-version": "event-routing-backends@1.1.1", + "https://w3id.org/xapi/openedx/extensions/session-id": "97662bef7c463c187b8fd91e0f580468" + } + } +} diff --git a/event_routing_backends/processors/xapi/tests/fixtures/expected/problem_check(server,multiple_questions,partially_correct).json b/event_routing_backends/processors/xapi/tests/fixtures/expected/problem_check(server,multiple_questions,partially_correct).json new file mode 100644 index 00000000..f3fe2a7b --- /dev/null +++ b/event_routing_backends/processors/xapi/tests/fixtures/expected/problem_check(server,multiple_questions,partially_correct).json @@ -0,0 +1,45 @@ +{ + "id": "6d1f033b-3f70-458c-b53a-e6bb63cbaef9", + "result": {"score": {"min": 0.0}, "success": false}, + "version": "1.0.3", + "actor": { + "objectType": "Agent", + "account": { + "name": "32e08e30-f8ae-4ce2-94a8-c2bfe38a70cb", + "homePage": "http://localhost:18000" + } + }, + "verb": { + "id": "https://w3id.org/xapi/acrossx/verbs/evaluated", + "display": { + "en": "evaluated" + } + }, + "object": { + "objectType": "Activity", + "definition": { + "type": "http://adlnet.gov/expapi/activities/cmi.interaction", + "interactionType": "choice" + } + }, + "context": { + "contextActivities": { + "parent": [ + { + "id": "http://localhost:18000/course/course-v1:edX+DemoX+Demo_Course", + "objectType": "Activity", + "definition": { + "name": { + "en-US": "Demonstration Course" + }, + "type": "http://adlnet.gov/expapi/activities/course" + } + } + ] + }, + "extensions": { + "https://w3id.org/xapi/openedx/extension/transformer-version": "event-routing-backends@1.1.1", + "https://w3id.org/xapi/openedx/extensions/session-id": "97662bef7c463c187b8fd91e0f580468" + } + } +}