-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from open-craft/josuebc/BB-1126
BB-1126 Map block ids into correct course ids when importing XML
- Loading branch information
Showing
5 changed files
with
73 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,4 @@ six | |
web-fragments | ||
webob | ||
XBlock | ||
edx-opaque-keys==0.4.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
""" | ||
Test EOC Journal Block import. | ||
""" | ||
|
||
import unittest | ||
from mock import Mock, patch | ||
from django.test import TestCase | ||
from eoc_journal.eoc_journal import EOCJournalXBlock | ||
|
||
|
||
class TestEOCJournalImport(TestCase): | ||
""" | ||
Test End of Course Journal Import | ||
""" | ||
|
||
@patch('eoc_journal.eoc_journal.XBlock.parse_xml', | ||
return_value=Mock(autospec=EOCJournalXBlock) | ||
) | ||
def test_parse_xml(self, mock_xblock_parse_xml): | ||
mock_xblock_parse_xml().selected_pb_answer_blocks = [ | ||
'i4x://Org/Course/pb-answer/b86edf60454b47dbb8f2e1b4e2d48d6a', | ||
'i4x://Org/Course/pb-answer/6f070c350e39429cbccfd3185a33621c', | ||
'i4x://Org/Course/pb-answer/a0b04a13d3074229b6be33fbc31de233', | ||
'i4x://Org/Course/pb-answer/927c5b8cd051475e937b8c1091a9feaf', | ||
] | ||
mock_node = Mock() | ||
mock_runtime = Mock() | ||
mock_keys = Mock() | ||
mock_id_generator = Mock(target_course_id='Org/CourseToImport/2014') | ||
block = EOCJournalXBlock.parse_xml(mock_node, mock_runtime, mock_keys, mock_id_generator) | ||
for block_id in block.selected_pb_answer_blocks: | ||
self.assertTrue(block_id.startswith('i4x://Org/CourseToImport')) |