class SectionTest(TestCase): def setUp(self): self.user = UserFactory() self.section = RootSectionFactory() def test_add_pageblock_from_dict(self): self.section.add_pageblock_from_dict({ 'block_type': 'Test Block', 'body': 'test body', }) block = self.section.pageblock_set.first() assert(block is not None) self.assertEqual(block.block().body, 'test body') self.assertEqual( self.section.pageblock_set.first(), block, 'The PageBlock has been added to the Section') def test_empty_section_is_unlocked(self): self.assertTrue(self.section.unlocked(self.user)) def test_section_with_test_block_is_unlocked(self): self.section.add_pageblock_from_dict({'block_type': 'Test Block'}) self.assertEqual(self.section.pageblock_set.count(), 1) # TestBlock doesn't have an "unlocked" method defined, so this # tests that Section.unlocked() handles that case. self.assertTrue(self.section.unlocked(self.user))
class SectionTest(TestCase): def setUp(self): self.user = UserFactory() self.section = RootSectionFactory() def test_add_pageblock_from_dict(self): self.section.add_pageblock_from_dict({ 'block_type': 'Test Block', 'body': 'test body', }) block = self.section.pageblock_set.first() assert (block is not None) self.assertEqual(block.block().body, 'test body') self.assertEqual(self.section.pageblock_set.first(), block, 'The PageBlock has been added to the Section') def test_empty_section_is_unlocked(self): self.assertTrue(self.section.unlocked(self.user)) def test_section_with_test_block_is_unlocked(self): self.section.add_pageblock_from_dict({'block_type': 'Test Block'}) self.assertEqual(self.section.pageblock_set.count(), 1) # TestBlock doesn't have an "unlocked" method defined, so this # tests that Section.unlocked() handles that case. self.assertTrue(self.section.unlocked(self.user))
def setUp(self): self.user = UserFactory() self.section = RootSectionFactory()
def setUp(self): self.s = RootSectionFactory()
class RootSectionTest(TestCase): def setUp(self): self.s = RootSectionFactory() def test_is_valid_from_factory(self): self.s.full_clean()