Ejemplo n.º 1
0
    def test_prereq_with_flavours(self):
        """ requirements have flavours and prereq does too, therefore moar cards """

        content_item = factories.ContentItemFactory(
            flavours=[TYPESCRIPT, JAVASCRIPT]
        )

        requirement1 = factories.CurriculumContentRequirementFactory(
            content_item=factories.ContentItemFactory(flavours=[TYPESCRIPT]),
            curriculum=self.curriculum,
            hard_requirement=True,
            flavours=[TYPESCRIPT],
        )
        requirement2 = factories.CurriculumContentRequirementFactory(
            content_item=factories.ContentItemFactory(flavours=[JAVASCRIPT]),
            curriculum=self.curriculum,
            hard_requirement=False,
            flavours=[JAVASCRIPT],
        )

        factories.ContentItemOrderFactory(
            post=requirement1.content_item, pre=content_item
        )
        factories.ContentItemOrderFactory(
            post=requirement2.content_item, pre=content_item
        )

        l = gen_helpers.get_ordered_content_items(self.curriculum)

        # since content_item has available flavours, it will be associated with TWO cards

        self.assertEqual(len(l), 4)

        self.assertEqual(l[0].content_item, content_item)
        self.assertEqual(l[0].is_hard_milestone, False)
        self.assertEqual(l[0].is_soft_milestone, False)
        self.assertEqual([o.name for o in l[0].flavours], [TYPESCRIPT])

        self.assertEqual(l[1].content_item, requirement1.content_item)
        self.assertEqual(l[1].is_hard_milestone, True)
        self.assertEqual(l[1].is_soft_milestone, False)
        self.assertEqual([o.name for o in l[1].flavours], [TYPESCRIPT])

        self.assertEqual(l[2].content_item, content_item)
        self.assertEqual(l[2].is_hard_milestone, False)
        self.assertEqual(l[2].is_soft_milestone, False)
        self.assertEqual([o.name for o in l[2].flavours], [JAVASCRIPT])

        self.assertEqual(l[3].content_item, requirement2.content_item)
        self.assertEqual(l[3].is_hard_milestone, False)
        self.assertEqual(l[3].is_soft_milestone, True)
        self.assertEqual([o.name for o in l[3].flavours], [JAVASCRIPT])
Ejemplo n.º 2
0
    def test_no_prepreq(self):
        requirement1 = factories.CurriculumContentRequirementFactory(
            curriculum=self.curriculum, hard_requirement=True)
        requirement2 = factories.CurriculumContentRequirementFactory(
            curriculum=self.curriculum, hard_requirement=False)

        l = gen_helpers.get_ordered_content_items(self.curriculum)

        self.assertEqual(l[0].content_item, requirement1.content_item)
        self.assertEqual(l[0].is_hard_milestone, True)
        self.assertEqual(l[0].is_soft_milestone, False)
        self.assertEqual(l[0].flavours, [])

        self.assertEqual(l[1].content_item, requirement2.content_item)
        self.assertEqual(l[1].is_hard_milestone, False)
        self.assertEqual(l[1].is_soft_milestone, True)
        self.assertEqual(l[1].flavours, [])
    def setUp(self):
        # user = core_factories.UserFactory()
        registration = factories.CourseRegistrationFactory()
        registration2 = factories.CourseRegistrationFactory(
            curriculum=registration.curriculum)
        self.user1 = registration.user
        self.user2 = registration2.user
        self.curriculum = registration.curriculum
        self.content_item = factories.ProjectContentItemFactory(
            flavours=[JAVASCRIPT])

        factories.CurriculumContentRequirementFactory(
            content_item=self.content_item,
            curriculum=self.curriculum,
            flavours=[JAVASCRIPT],
        )
Ejemplo n.º 4
0
    def setUp(self):

        curriculum_content = factories.CurriculumContentRequirementFactory()
        self.curriculum = curriculum_content.curriculum
        self.content_item = curriculum_content.content_item