Пример #1
0
    def test_as_dict_create_from_dict(self):
        block = QuizSummaryBlockFactory()
        d = block.as_dict()
        self.assertEquals(block.quiz_class, d['quiz_class'])

        block2 = QuizSummaryBlock.create_from_dict(d)
        self.assertEquals(block2.quiz_class, block.quiz_class)
Пример #2
0
    def test_basics(self):
        block = QuizSummaryBlockFactory()
        ModuleFactory("one", "/pages/one/")
        self.hierarchy = Hierarchy.objects.get(name='one')
        self.section_one = Section.objects.get(slug='one')

        self.section_one.append_pageblock('test', '', block)

        self.assertTrue(block.__str__().startswith('One'))
        self.assertIsNotNone(block.pageblock())
        self.assertFalse(block.needs_submit())
        self.assertTrue(block.unlocked(None))
Пример #3
0
 def test_edit(self):
     block = QuizSummaryBlockFactory()
     block.edit({'quiz_class': 'updated class'}, None)
     self.assertEquals(block.quiz_class, 'updated class')
Пример #4
0
 def test_edit_form(self):
     edit_form = QuizSummaryBlockFactory().edit_form()
     self.assertTrue("quiz_class" in edit_form.fields)
Пример #5
0
 def test_add_form(self):
     add_form = QuizSummaryBlockFactory().add_form()
     self.assertTrue("quiz_class" in add_form.fields)