From 37cffd08356adaa76ea686cb36a03b5b2419103f Mon Sep 17 00:00:00 2001 From: Valera Rozuvan Date: Fri, 31 May 2013 13:48:17 +0300 Subject: [PATCH 1/4] Added videoalpha to advanced components in component.py file. --- cms/djangoapps/contentstore/views/component.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cms/djangoapps/contentstore/views/component.py b/cms/djangoapps/contentstore/views/component.py index 30005d45243f..610426fbefc5 100644 --- a/cms/djangoapps/contentstore/views/component.py +++ b/cms/djangoapps/contentstore/views/component.py @@ -42,7 +42,7 @@ OPEN_ENDED_COMPONENT_TYPES = ["combinedopenended", "peergrading"] NOTE_COMPONENT_TYPES = ['notes'] -ADVANCED_COMPONENT_TYPES = ['annotatable', 'word_cloud'] + OPEN_ENDED_COMPONENT_TYPES + NOTE_COMPONENT_TYPES +ADVANCED_COMPONENT_TYPES = ['annotatable', 'word_cloud', 'videoalpha'] + OPEN_ENDED_COMPONENT_TYPES + NOTE_COMPONENT_TYPES ADVANCED_COMPONENT_CATEGORY = 'advanced' ADVANCED_COMPONENT_POLICY_KEY = 'advanced_modules' From ba9a5b3824011a7c9cf5bc73be9b36807a8bc408 Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Sun, 2 Jun 2013 00:15:34 -0400 Subject: [PATCH 2/4] add simple check on whether the expected advanced modules appear in the edit unit page when turned on --- .../contentstore/tests/test_contentstore.py | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/cms/djangoapps/contentstore/tests/test_contentstore.py b/cms/djangoapps/contentstore/tests/test_contentstore.py index a36ed76d1152..a760a1473820 100644 --- a/cms/djangoapps/contentstore/tests/test_contentstore.py +++ b/cms/djangoapps/contentstore/tests/test_contentstore.py @@ -34,6 +34,8 @@ from xmodule.seq_module import SequenceDescriptor from xmodule.modulestore.exceptions import ItemNotFoundError +from contentstore.views.component import ADVANCED_COMPONENT_TYPES, ADVANCED_COMPONENT_POLICY_KEY + from django_comment_common.utils import are_permissions_roles_seeded TEST_DATA_MODULESTORE = copy.deepcopy(settings.MODULESTORE) @@ -75,6 +77,30 @@ def setUp(self): self.client = Client() self.client.login(username=uname, password=password) + def test_advanced_components_in_edit_unit(self): + store = modulestore('direct') + import_from_xml(store, 'common/test/data/', ['simple']) + + course = store.get_item(Location(['i4x', 'edX', 'simple', + 'course', '2012_Fall', None]), depth=None) + + course.advanced_modules = ADVANCED_COMPONENT_TYPES + + store.update_metadata(course.location, own_metadata(course)) + + # just pick one vertical + descriptor = store.get_items(Location('i4x', 'edX', 'simple', 'vertical', None, None))[0] + + resp = self.client.get(reverse('edit_unit', kwargs={'location': descriptor.location.url()})) + self.assertEqual(resp.status_code, 200) + + # This could be made better, but for now let's just assert that we see the advanced modules mentioned in the page + # response HTML + self.assertIn('Video Alpha', resp.content) + self.assertIn('Word cloud', resp.content) + self.assertIn('Annotation', resp.content) + self.assertIn('Open Ended Response', resp.content) + def check_edit_unit(self, test_course_name): import_from_xml(modulestore('direct'), 'common/test/data/', [test_course_name]) From c0899463e3170f0debd66106fdd0c1aeb18353fb Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Sun, 2 Jun 2013 00:18:35 -0400 Subject: [PATCH 3/4] remove unused import reference --- cms/djangoapps/contentstore/tests/test_contentstore.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cms/djangoapps/contentstore/tests/test_contentstore.py b/cms/djangoapps/contentstore/tests/test_contentstore.py index a760a1473820..30cf3a47d530 100644 --- a/cms/djangoapps/contentstore/tests/test_contentstore.py +++ b/cms/djangoapps/contentstore/tests/test_contentstore.py @@ -34,7 +34,7 @@ from xmodule.seq_module import SequenceDescriptor from xmodule.modulestore.exceptions import ItemNotFoundError -from contentstore.views.component import ADVANCED_COMPONENT_TYPES, ADVANCED_COMPONENT_POLICY_KEY +from contentstore.views.component import ADVANCED_COMPONENT_TYPES from django_comment_common.utils import are_permissions_roles_seeded From 6fb520f21ec0a0443740d09cc8e143e83d366e43 Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Sun, 2 Jun 2013 14:39:36 -0400 Subject: [PATCH 4/4] add peer grading to the advanced components check --- cms/djangoapps/contentstore/tests/test_contentstore.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cms/djangoapps/contentstore/tests/test_contentstore.py b/cms/djangoapps/contentstore/tests/test_contentstore.py index 30cf3a47d530..0b4535bb701a 100644 --- a/cms/djangoapps/contentstore/tests/test_contentstore.py +++ b/cms/djangoapps/contentstore/tests/test_contentstore.py @@ -100,6 +100,7 @@ def test_advanced_components_in_edit_unit(self): self.assertIn('Word cloud', resp.content) self.assertIn('Annotation', resp.content) self.assertIn('Open Ended Response', resp.content) + self.assertIn('Peer Grading Interface', resp.content) def check_edit_unit(self, test_course_name): import_from_xml(modulestore('direct'), 'common/test/data/', [test_course_name])