Commit 2b396453 by Usman Khalid

Fixed xml tests.

TNL-708:wq
parent e6e75978
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
"simple": { "simple": {
"xml": [ "xml": [
"<rubric>", "<rubric>",
"<prompt>Test prompt</prompt>",
"<criterion>", "<criterion>",
"<name>Test criterion</name>", "<name>Test criterion</name>",
"<prompt>Test criterion prompt</prompt>", "<prompt>Test criterion prompt</prompt>",
...@@ -11,7 +10,6 @@ ...@@ -11,7 +10,6 @@
"</criterion>", "</criterion>",
"</rubric>" "</rubric>"
], ],
"prompt": "Test prompt",
"feedbackprompt": null, "feedbackprompt": null,
"criteria": [ "criteria": [
{ {
...@@ -43,7 +41,6 @@ ...@@ -43,7 +41,6 @@
"feedback_prompt": { "feedback_prompt": {
"xml": [ "xml": [
"<rubric>", "<rubric>",
"<prompt>Test prompt</prompt>",
"<criterion>", "<criterion>",
"<name>Test criterion</name>", "<name>Test criterion</name>",
"<prompt>Test criterion prompt</prompt>", "<prompt>Test criterion prompt</prompt>",
...@@ -53,7 +50,6 @@ ...@@ -53,7 +50,6 @@
"<feedbackprompt>This is the feedback prompt</feedbackprompt>", "<feedbackprompt>This is the feedback prompt</feedbackprompt>",
"</rubric>" "</rubric>"
], ],
"prompt": "Test prompt",
"feedbackprompt": "This is the feedback prompt", "feedbackprompt": "This is the feedback prompt",
"criteria": [ "criteria": [
{ {
...@@ -93,7 +89,6 @@ ...@@ -93,7 +89,6 @@
"</criterion>", "</criterion>",
"</rubric>" "</rubric>"
], ],
"prompt": null,
"feedbackprompt": null, "feedbackprompt": null,
"criteria": [ "criteria": [
{ {
...@@ -125,7 +120,6 @@ ...@@ -125,7 +120,6 @@
"empty_prompt": { "empty_prompt": {
"xml": [ "xml": [
"<rubric>", "<rubric>",
"<prompt></prompt>",
"<criterion>", "<criterion>",
"<name>Test criterion</name>", "<name>Test criterion</name>",
"<prompt>Test criterion prompt</prompt>", "<prompt>Test criterion prompt</prompt>",
...@@ -134,7 +128,6 @@ ...@@ -134,7 +128,6 @@
"</criterion>", "</criterion>",
"</rubric>" "</rubric>"
], ],
"prompt": "",
"feedbackprompt": null, "feedbackprompt": null,
"criteria": [ "criteria": [
{ {
...@@ -166,7 +159,6 @@ ...@@ -166,7 +159,6 @@
"unicode": { "unicode": {
"xml": [ "xml": [
"<rubric>", "<rubric>",
"<prompt>ՇєรՇ קг๏๓קՇ</prompt>",
"<criterion>", "<criterion>",
"<name>𝓣𝓮𝓼𝓽 𝓬𝓻𝓲𝓽𝓮𝓻𝓲𝓸𝓷</name>", "<name>𝓣𝓮𝓼𝓽 𝓬𝓻𝓲𝓽𝓮𝓻𝓲𝓸𝓷</name>",
"<prompt>Ŧɇsŧ ȼɍɨŧɇɍɨøn ꝑɍømꝑŧ</prompt>", "<prompt>Ŧɇsŧ ȼɍɨŧɇɍɨøn ꝑɍømꝑŧ</prompt>",
...@@ -175,7 +167,6 @@ ...@@ -175,7 +167,6 @@
"</criterion>", "</criterion>",
"</rubric>" "</rubric>"
], ],
"prompt": "ՇєรՇ קг๏๓קՇ",
"feedbackprompt": null, "feedbackprompt": null,
"criteria": [ "criteria": [
{ {
...@@ -207,7 +198,6 @@ ...@@ -207,7 +198,6 @@
"multiple_criteria": { "multiple_criteria": {
"xml": [ "xml": [
"<rubric>", "<rubric>",
"<prompt>Test prompt</prompt>",
"<criterion>", "<criterion>",
"<name>Test criterion</name>", "<name>Test criterion</name>",
"<prompt>Test criterion prompt</prompt>", "<prompt>Test criterion prompt</prompt>",
...@@ -221,7 +211,6 @@ ...@@ -221,7 +211,6 @@
"</criterion>", "</criterion>",
"</rubric>" "</rubric>"
], ],
"prompt": "Test prompt",
"feedbackprompt": null, "feedbackprompt": null,
"criteria": [ "criteria": [
{ {
...@@ -269,7 +258,6 @@ ...@@ -269,7 +258,6 @@
"criterion_feedback_optional": { "criterion_feedback_optional": {
"xml": [ "xml": [
"<rubric>", "<rubric>",
"<prompt>Test prompt</prompt>",
"<criterion>", "<criterion>",
"<name>Test criterion</name>", "<name>Test criterion</name>",
"<prompt>Test criterion prompt</prompt>", "<prompt>Test criterion prompt</prompt>",
...@@ -283,7 +271,6 @@ ...@@ -283,7 +271,6 @@
"</criterion>", "</criterion>",
"</rubric>" "</rubric>"
], ],
"prompt": "Test prompt",
"feedbackprompt": null, "feedbackprompt": null,
"criteria": [ "criteria": [
{ {
......
...@@ -10,6 +10,8 @@ import pytz ...@@ -10,6 +10,8 @@ import pytz
import dateutil.parser import dateutil.parser
from django.test import TestCase from django.test import TestCase
import ddt import ddt
from openassessment.xblock.data_conversion import create_prompts_dict
from openassessment.xblock.openassessmentblock import OpenAssessmentBlock from openassessment.xblock.openassessmentblock import OpenAssessmentBlock
from openassessment.xblock.xml import ( from openassessment.xblock.xml import (
serialize_content, parse_from_xml_str, parse_rubric_xml, serialize_content, parse_from_xml_str, parse_rubric_xml,
...@@ -99,6 +101,7 @@ class TestSerializeContent(TestCase): ...@@ -99,6 +101,7 @@ class TestSerializeContent(TestCase):
def _configure_xblock(self, data): def _configure_xblock(self, data):
self.oa_block.title = data.get('title', '') self.oa_block.title = data.get('title', '')
self.oa_block.prompt = data.get('prompt') self.oa_block.prompt = data.get('prompt')
self.oa_block.prompts = create_prompts_dict(data.get('prompt'))
self.oa_block.rubric_feedback_prompt = data.get('rubric_feedback_prompt') self.oa_block.rubric_feedback_prompt = data.get('rubric_feedback_prompt')
self.oa_block.rubric_feedback_default_text = data.get('rubric_feedback_default_text') self.oa_block.rubric_feedback_default_text = data.get('rubric_feedback_default_text')
self.oa_block.start = _parse_date(data.get('start')) self.oa_block.start = _parse_date(data.get('start'))
...@@ -361,7 +364,6 @@ class TestParseRubricFromXml(TestCase): ...@@ -361,7 +364,6 @@ class TestParseRubricFromXml(TestCase):
xml = etree.fromstring("".join(data['xml'])) xml = etree.fromstring("".join(data['xml']))
rubric = parse_rubric_xml(xml) rubric = parse_rubric_xml(xml)
self.assertEqual(rubric['prompt'], data['prompt'])
self.assertEqual(rubric['feedbackprompt'], data['feedbackprompt']) self.assertEqual(rubric['feedbackprompt'], data['feedbackprompt'])
self.assertEqual(rubric['criteria'], data['criteria']) self.assertEqual(rubric['criteria'], data['criteria'])
...@@ -401,7 +403,7 @@ class TestParseFromXml(TestCase): ...@@ -401,7 +403,7 @@ class TestParseFromXml(TestCase):
# Check that the contents of the modified XBlock are correct # Check that the contents of the modified XBlock are correct
expected_fields = [ expected_fields = [
'title', 'title',
'prompt', 'prompts',
'start', 'start',
'due', 'due',
'submission_start', 'submission_start',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment