def test_no_flavours(self):

        content_item = factories.ProjectContentItemFactory()

        card = factories.AgileCardFactory(
            content_item=content_item, recruit_project=None
        )
        user = card.assignees.first()

        self.assertIsNone(card.recruit_project)
        assert user is not None
        update_project_card_progress(user)
        card.refresh_from_db()
        self.assertEqual(card.status, card.READY)

        progress = factories.RecruitProjectFactory(
            content_item=content_item,
            review_request_time=timezone.now() - timezone.timedelta(days=1),
            start_time=timezone.now() - timezone.timedelta(days=2),
        )
        progress.recruit_users.add(user)

        factories.RecruitProjectReviewFactory(
            recruit_project=progress,
            status=NOT_YET_COMPETENT,
            timestamp=timezone.now(),
        )

        update_project_card_progress(user)
        card.refresh_from_db()
        self.assertEqual(card.status, models.AgileCard.REVIEW_FEEDBACK)
예제 #2
0
    def test_with_flavours(self):
        content_item = factories.ProjectContentItemFactory(
            content_type=models.ContentItem.PROJECT,
            available_flavours=[JAVASCRIPT, TYPESCRIPT],
        )

        card_ts = factories.AgileCardFactory(
            content_item=content_item,
            content_flavours=[TYPESCRIPT],
            recruit_project=None,
        )
        card_ts.assignees.add(self.user)

        card_js = factories.AgileCardFactory(
            content_item=content_item,
            content_flavours=[JAVASCRIPT],
            recruit_project=None,
        )
        card_js.assignees.add(self.user)

        progress = factories.RecruitProjectFactory(
            content_item=content_item,
            review_request_time=None,
        )
        progress.recruit_users.add(self.user)
        progress.flavours.add(
            taggit.models.Tag.objects.get_or_create(name=TYPESCRIPT)[0]
        )

        update_project_card_progress(self.user)
        card_ts.refresh_from_db()
        card_js.refresh_from_db()

        self.assertEqual(card_js.status, card_ts.READY)
        self.assertEqual(card_ts.status, card_ts.IN_PROGRESS)
예제 #3
0
    def test_length_ok(self):
        project = factories.ProjectContentItemFactory()
        repo_name = models.RecruitProject._generate_repo_name_for_project(
            user=self.user, content_item=project, flavour_names=["javascript", "react"]
        )

        self.assertIn(str(project.id), repo_name)
        self.assertIn(project.slug, repo_name)
        self.assertIn(self.user.first_name, repo_name)
        self.assertIn(self.user.last_name, repo_name)
예제 #4
0
    def test_too_long(self):
        project = factories.ProjectContentItemFactory(title="test project " * 10)
        self.assertGreater(len(project.slug), 100)
        repo_name = models.RecruitProject._generate_repo_name_for_project(
            user=self.user, content_item=project, flavour_names=[]
        )

        self.assertIn(str(project.id), repo_name)
        self.assertIn("-test-project-", repo_name)
        self.assertIn(self.user.first_name, repo_name)
        self.assertIn(self.user.last_name, repo_name)
    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],
        )
    def test_with_flavours(self):
        content_item = factories.ProjectContentItemFactory(
            content_type=models.ContentItem.PROJECT,
            flavours=[JAVASCRIPT, TYPESCRIPT],
        )

        card_ts = factories.AgileCardFactory(
            content_item=content_item,
            flavours=[TYPESCRIPT],
            recruit_project=None,
        )
        user = card_ts.assignees.first()

        # card_ts.assignees.add(self.user)

        card_js = factories.AgileCardFactory(
            content_item=content_item,
            flavours=[JAVASCRIPT],
            recruit_project=None,
            assignees=[user],
        )
        # card_js.assignees.add(self.user)
        assert user == card_js.assignees.first()

        progress = factories.RecruitProjectFactory(
            content_item=content_item,
            review_request_time=None,
            start_time=timezone.now() - timezone.timedelta(days=2),
        )
        progress.recruit_users.add(user)
        progress.flavours.add(
            taggit.models.Tag.objects.get_or_create(name=TYPESCRIPT)[0]
        )

        update_project_card_progress(user)
        card_ts.refresh_from_db()
        card_js.refresh_from_db()

        self.assertEqual(card_js.status, card_js.READY)
        self.assertEqual(card_ts.status, card_ts.IN_PROGRESS)