コード例 #1
0
 def test_rendered_template_context_disallows_edit_when_section_is_primary(
         self, get_section, is_editable_section, render):
     """ Ensure sections that are primary are not allowed to be edited per context variable """
     is_editable_section.return_value = False
     section_details(self.request, self.section_id)
     self.assertEqual(self.get_render_context_value(render, 'allow_edit'),
                      False)
コード例 #2
0
 def test_rendered_template_name(self, get_section, is_editable_section,
                                 render):
     """ Ensure name of rendered section is expected """
     section_details(self.request, self.section_id)
     render.assert_called_once_with(ANY,
                                    'manage_sections/section_details.html',
                                    ANY)
コード例 #3
0
 def test_rendered_template_context_contains_section_name(
         self, get_section, is_editable_section, render):
     """ Ensure expected section name contained in template context """
     section_name = 'test-section-name'
     get_section.return_value = {'name': section_name}
     section_details(self.request, self.section_id)
     self.assertEqual(self.get_render_context_value(render, 'section_name'),
                      section_name)
コード例 #4
0
 def test_rendered_template_context_contains_section_id(
         self, get_section, is_editable_section, render):
     """ Ensure expected section_id contained in template context """
     section_details(self.request, self.section_id)
     self.assertEqual(self.get_render_context_value(render, 'section_id'),
                      self.section_id)
コード例 #5
0
 def test_is_editable_section_called(self, get_section, is_editable_section,
                                     render):
     """ Ensure is_editable_section is called using return value from get_section """
     section_details(self.request, self.section_id)
     is_editable_section.assert_called_once_with(get_section.return_value)
 def test_rendered_template_context_disallows_edit_when_section_is_primary(self, get_section, is_editable_section, render):
     """ Ensure sections that are primary are not allowed to be edited per context variable """
     is_editable_section.return_value = False
     section_details(self.request, self.section_id)
     self.assertEqual(self.get_render_context_value(render, 'allow_edit'), False)
コード例 #7
0
 def test_retrieve_section_by_id(self, get_section, is_editable_section,
                                 render):
     """ Ensure that get_section was called with id passed into view """
     section_details(self.request, self.section_id)
     get_section.assert_called_once_with(self.canvas_course_id,
                                         self.section_id)
 def test_rendered_template_context_contains_section_name(self, get_section, is_editable_section, render):
     """ Ensure expected section name contained in template context """
     section_name = 'test-section-name'
     get_section.return_value = {'name': section_name}
     section_details(self.request, self.section_id)
     self.assertEqual(self.get_render_context_value(render, 'section_name'), section_name)
 def test_rendered_template_context_contains_section_id(self, get_section, is_editable_section, render):
     """ Ensure expected section_id contained in template context """
     section_details(self.request, self.section_id)
     self.assertEqual(self.get_render_context_value(render, 'section_id'), self.section_id)
 def test_rendered_template_name(self, get_section, is_editable_section, render):
     """ Ensure name of rendered section is expected """
     section_details(self.request, self.section_id)
     render.assert_called_once_with(ANY, 'manage_sections/section_details.html', ANY)
 def test_is_editable_section_called(self, get_section, is_editable_section, render):
     """ Ensure is_editable_section is called using return value from get_section """
     section_details(self.request, self.section_id)
     is_editable_section.assert_called_once_with(get_section.return_value)
 def test_retrieve_section_by_id(self, get_section, is_editable_section, render):
     """ Ensure that get_section was called with id passed into view """
     section_details(self.request, self.section_id)
     get_section.assert_called_once_with(self.canvas_course_id, self.section_id)