Commit c450145f by Sarina Canelake

Update CMS Contentstore tests to not use ORA1 examples

parent e023fb25
...@@ -698,7 +698,7 @@ class MiscCourseTests(ContentStoreTestCase): ...@@ -698,7 +698,7 @@ class MiscCourseTests(ContentStoreTestCase):
self.check_components_on_page( self.check_components_on_page(
ADVANCED_COMPONENT_TYPES, ADVANCED_COMPONENT_TYPES,
['Word cloud', 'Annotation', 'Text Annotation', 'Video Annotation', 'Image Annotation', ['Word cloud', 'Annotation', 'Text Annotation', 'Video Annotation', 'Image Annotation',
'Open Response Assessment', 'Peer Grading Interface', 'split_test'], 'split_test'],
) )
@ddt.data('/Fake/asset/displayname', '\\Fake\\asset\\displayname') @ddt.data('/Fake/asset/displayname', '\\Fake\\asset\\displayname')
......
...@@ -905,48 +905,21 @@ class CourseMetadataEditingTest(CourseTestCase): ...@@ -905,48 +905,21 @@ class CourseMetadataEditingTest(CourseTestCase):
""" """
Test that adding and removing specific advanced components adds and removes tabs. Test that adding and removing specific advanced components adds and removes tabs.
""" """
open_ended_tab = {"type": "open_ended", "name": "Open Ended Panel"}
peer_grading_tab = {"type": "peer_grading", "name": "Peer grading"}
# First ensure that none of the tabs are visible # First ensure that none of the tabs are visible
self.assertNotIn(open_ended_tab, self.course.tabs)
self.assertNotIn(peer_grading_tab, self.course.tabs)
self.assertNotIn(self.notes_tab, self.course.tabs) self.assertNotIn(self.notes_tab, self.course.tabs)
# Now add the "combinedopenended" component and verify that the tab has been added # Now enable student notes and verify that the "My Notes" tab has been added
self.client.ajax_post(self.course_setting_url, {
ADVANCED_COMPONENT_POLICY_KEY: {"value": ["combinedopenended"]}
})
course = modulestore().get_course(self.course.id)
self.assertIn(open_ended_tab, course.tabs)
self.assertIn(peer_grading_tab, course.tabs)
self.assertNotIn(self.notes_tab, course.tabs)
# Now enable student notes and verify that the "My Notes" tab has also been added
self.client.ajax_post(self.course_setting_url, {
ADVANCED_COMPONENT_POLICY_KEY: {"value": ["combinedopenended", "notes"]}
})
course = modulestore().get_course(self.course.id)
self.assertIn(open_ended_tab, course.tabs)
self.assertIn(peer_grading_tab, course.tabs)
self.assertIn(self.notes_tab, course.tabs)
# Now remove the "combinedopenended" component and verify that the tab is gone
self.client.ajax_post(self.course_setting_url, { self.client.ajax_post(self.course_setting_url, {
ADVANCED_COMPONENT_POLICY_KEY: {"value": ["notes"]} ADVANCED_COMPONENT_POLICY_KEY: {"value": ["notes"]}
}) })
course = modulestore().get_course(self.course.id) course = modulestore().get_course(self.course.id)
self.assertNotIn(open_ended_tab, course.tabs)
self.assertNotIn(peer_grading_tab, course.tabs)
self.assertIn(self.notes_tab, course.tabs) self.assertIn(self.notes_tab, course.tabs)
# Finally disable student notes and verify that the "My Notes" tab is gone # Disable student notes and verify that the "My Notes" tab is gone
self.client.ajax_post(self.course_setting_url, { self.client.ajax_post(self.course_setting_url, {
ADVANCED_COMPONENT_POLICY_KEY: {"value": [""]} ADVANCED_COMPONENT_POLICY_KEY: {"value": [""]}
}) })
course = modulestore().get_course(self.course.id) course = modulestore().get_course(self.course.id)
self.assertNotIn(open_ended_tab, course.tabs)
self.assertNotIn(peer_grading_tab, course.tabs)
self.assertNotIn(self.notes_tab, course.tabs) self.assertNotIn(self.notes_tab, course.tabs)
def test_advanced_components_munge_tabs_validation_failure(self): def test_advanced_components_munge_tabs_validation_failure(self):
......
...@@ -219,26 +219,6 @@ class ContentStoreImportTest(SignalDisconnectTestMixin, ModuleStoreTestCase): ...@@ -219,26 +219,6 @@ class ContentStoreImportTest(SignalDisconnectTestMixin, ModuleStoreTestCase):
conditional_module.show_tag_list conditional_module.show_tag_list
) )
def test_rewrite_reference(self):
module_store = modulestore()
target_id = module_store.make_course_key('testX', 'peergrading_copy', 'copy_run')
import_course_from_xml(
module_store,
self.user.id,
TEST_DATA_DIR,
['open_ended'],
target_id=target_id,
create_if_not_present=True
)
peergrading_module = module_store.get_item(
target_id.make_usage_key('peergrading', 'PeerGradingLinked')
)
self.assertIsNotNone(peergrading_module)
self.assertEqual(
target_id.make_usage_key('combinedopenended', 'SampleQuestion'),
peergrading_module.link_to_location
)
def test_rewrite_reference_value_dict_published(self): def test_rewrite_reference_value_dict_published(self):
""" """
Test rewriting references in ReferenceValueDict, specifically with published content. Test rewriting references in ReferenceValueDict, specifically with published content.
......
...@@ -1388,28 +1388,28 @@ class TestComponentTemplates(CourseTestCase): ...@@ -1388,28 +1388,28 @@ class TestComponentTemplates(CourseTestCase):
Test the handling of advanced problem templates. Test the handling of advanced problem templates.
""" """
problem_templates = self.get_templates_of_type('problem') problem_templates = self.get_templates_of_type('problem')
ora_template = self.get_template(problem_templates, u'Peer Assessment') circuit_template = self.get_template(problem_templates, u'Circuit Schematic Builder')
self.assertIsNotNone(ora_template) self.assertIsNotNone(circuit_template)
self.assertEqual(ora_template.get('category'), 'openassessment') self.assertEqual(circuit_template.get('category'), 'problem')
self.assertIsNone(ora_template.get('boilerplate_name', None)) self.assertEqual(circuit_template.get('boilerplate_name'), 'circuitschematic.yaml')
@patch('django.conf.settings.DEPRECATED_ADVANCED_COMPONENT_TYPES', ["combinedopenended", "peergrading"]) @patch('django.conf.settings.DEPRECATED_ADVANCED_COMPONENT_TYPES', ["poll", "survey"])
def test_ora1_no_advance_component_button(self): def test_deprecated_no_advance_component_button(self):
""" """
Test that there will be no `Advanced` button on unit page if `combinedopenended` and `peergrading` are Test that there will be no `Advanced` button on unit page if units are
deprecated provided that there are only 'combinedopenended', 'peergrading' modules in `Advanced Module List` deprecated provided that they are the only modules in `Advanced Module List`
""" """
self.course.advanced_modules.extend(['combinedopenended', 'peergrading']) self.course.advanced_modules.extend(['poll', 'survey'])
templates = get_component_templates(self.course) templates = get_component_templates(self.course)
button_names = [template['display_name'] for template in templates] button_names = [template['display_name'] for template in templates]
self.assertNotIn('Advanced', button_names) self.assertNotIn('Advanced', button_names)
@patch('django.conf.settings.DEPRECATED_ADVANCED_COMPONENT_TYPES', ["combinedopenended", "peergrading"]) @patch('django.conf.settings.DEPRECATED_ADVANCED_COMPONENT_TYPES', ["poll", "survey"])
def test_cannot_create_ora1_problems(self): def test_cannot_create_deprecated_problems(self):
""" """
Test that we can't create ORA1 problems if `combinedopenended` and `peergrading` are deprecated Test that we can't create problems if they are deprecated
""" """
self.course.advanced_modules.extend(['annotatable', 'combinedopenended', 'peergrading']) self.course.advanced_modules.extend(['annotatable', 'poll', 'survey'])
templates = get_component_templates(self.course) templates = get_component_templates(self.course)
button_names = [template['display_name'] for template in templates] button_names = [template['display_name'] for template in templates]
self.assertIn('Advanced', button_names) self.assertIn('Advanced', button_names)
...@@ -1418,17 +1418,17 @@ class TestComponentTemplates(CourseTestCase): ...@@ -1418,17 +1418,17 @@ class TestComponentTemplates(CourseTestCase):
self.assertEqual(template_display_names, ['Annotation']) self.assertEqual(template_display_names, ['Annotation'])
@patch('django.conf.settings.DEPRECATED_ADVANCED_COMPONENT_TYPES', []) @patch('django.conf.settings.DEPRECATED_ADVANCED_COMPONENT_TYPES', [])
def test_create_ora1_problems(self): def test_create_non_deprecated_problems(self):
""" """
Test that we can create ORA1 problems if `combinedopenended` and `peergrading` are not deprecated Test that we can create problems if they are not deprecated
""" """
self.course.advanced_modules.extend(['annotatable', 'combinedopenended', 'peergrading']) self.course.advanced_modules.extend(['annotatable', 'poll', 'survey'])
templates = get_component_templates(self.course) templates = get_component_templates(self.course)
button_names = [template['display_name'] for template in templates] button_names = [template['display_name'] for template in templates]
self.assertIn('Advanced', button_names) self.assertIn('Advanced', button_names)
self.assertEqual(len(templates[0]['templates']), 3) self.assertEqual(len(templates[0]['templates']), 3)
template_display_names = [template['display_name'] for template in templates[0]['templates']] template_display_names = [template['display_name'] for template in templates[0]['templates']]
self.assertEqual(template_display_names, ['Annotation', 'Open Response Assessment', 'Peer Grading Interface']) self.assertEqual(template_display_names, ['Annotation', 'Poll', 'Survey'])
@ddt.ddt @ddt.ddt
......
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