Ejemplo n.º 1
0
    def test_one_card_in_progress_before_any_reviews(self):

        # One card, no reviews just yet, function 'get_cards_in_progress_column_as_assignee' should return one card
        self.assertEqual(self.card_1.status, AgileCard.IN_PROGRESS)
        self.assertEqual(self.project_1.content_item, self.card_1.content_item)
        self.assertEqual(AgileCard.derive_status_from_project(self.project_1),
                         AgileCard.IN_PROGRESS)
        self.assertEqual(
            self.stats_serializer.get_cards_in_progress_column_as_assignee(
                user=self.user), 1)
Ejemplo n.º 2
0
    def test_untrusted_nyc_after_request_for_review(self):
        self.project.request_review(force_timestamp=datetime.now() -
                                    timedelta(days=10))
        review = factories.RecruitProjectReviewFactory(
            status=NOT_YET_COMPETENT, recruit_project=self.project)
        self.assertFalse(review.trusted)

        self.assertEqual(
            AgileCard.derive_status_from_project(self.project),
            AgileCard.REVIEW_FEEDBACK,
        )
Ejemplo n.º 3
0
    def test_untrusted_competent_after_request_for_review(self):
        review = factories.RecruitProjectReviewFactory(
            status=COMPETENT, recruit_project=self.project)
        self.project.request_review(force_timestamp=datetime.now() -
                                    timedelta(days=10))

        self.assertFalse(review.trusted)

        # breakpoint()
        derived = AgileCard.derive_status_from_project(self.project)
        self.assertEqual(derived, AgileCard.IN_REVIEW)
Ejemplo n.º 4
0
    def test_trusted_competent_after_request_for_review(self):
        review = factories.RecruitProjectReviewFactory(
            status=COMPETENT,
            recruit_project=self.project,
            reviewer_user=self.trusted_user,
        )
        self.project.request_review(force_timestamp=datetime.now() -
                                    timedelta(days=10))

        self.assertTrue(review.trusted)

        self.assertEqual(AgileCard.derive_status_from_project(self.project),
                         AgileCard.COMPLETE)
Ejemplo n.º 5
0
    def test_trusted_nyc_before_request_for_review(self):
        review = factories.RecruitProjectReviewFactory(
            status=NOT_YET_COMPETENT,
            recruit_project=self.project,
            reviewer_user=self.trusted_user,
        )
        self.assertTrue(review.trusted)

        self.project.request_review(force_timestamp=datetime.now() +
                                    timedelta(days=10))

        self.assertEqual(AgileCard.derive_status_from_project(self.project),
                         AgileCard.IN_REVIEW)
Ejemplo n.º 6
0
    def test_request_review_but_no_review_done_since_time_of_review_request(
            self):
        project_two = factories.RecruitProjectFactory(
            content_item=factories.ProjectContentItemFactory(flavours=["js"]))
        project_two.review_request_time = timezone.now()

        # The next line had to be done because RecruitProjectFactory does not create an attribute 'recruit_project'
        # so I manually created a 'recruit_project' attribute.
        project_two.recruit_project = project_two

        self.assertEqual(
            AgileCard.get_users_that_reviewed_since_last_review_request(
                project_two), [])
Ejemplo n.º 7
0
    def test_untrusted_nyc_before_request_for_review(self):
        self.set_project_start_time()
        self.project.request_review(force_timestamp=timezone.now() +
                                    timedelta(days=10))
        review = factories.RecruitProjectReviewFactory(
            status=NOT_YET_COMPETENT,
            recruit_project=self.project,
        )

        self.assertFalse(review.trusted)

        self.assertEqual(AgileCard.derive_status_from_project(self.project),
                         AgileCard.IN_REVIEW)
Ejemplo n.º 8
0
    def test_trusted_nyc_after_request_for_review(self):
        self.set_project_start_time()
        self.project.request_review(force_timestamp=timezone.now() - timedelta(days=10))
        review = factories.RecruitProjectReviewFactory(
            status=NOT_YET_COMPETENT,
            recruit_project=self.project,
            reviewer_user=self.trusted_user,
        )

        self.assertTrue(review.trusted)

        self.assertEqual(
            AgileCard.derive_status_from_project(self.project),
            AgileCard.REVIEW_FEEDBACK,
        )
Ejemplo n.º 9
0
    def test_request_review_and_perform_review_since_time_of_review_request(
            self):

        # Creating a new project
        project_one = factories.RecruitProjectFactory(
            content_item=factories.ProjectContentItemFactory(flavours=["js"]))

        # Requesting a review on the project and performing a review on the project
        project_one.review_request_time = timezone.now()
        review_on_project_one = factories.RecruitProjectReviewFactory(
            recruit_project=project_one,
            reviewer_user=factories.UserFactory(),
        )

        # The next line had to be done because RecruitProjectFactory does not create an attribute 'recruit_project'
        # so I manually created a 'recruit_project' attribute.
        project_one.recruit_project = project_one

        self.assertEqual(
            AgileCard.get_users_that_reviewed_since_last_review_request(
                project_one),
            [review_on_project_one.reviewer_user.id],
        )
Ejemplo n.º 10
0
 def test_no_reviews_or_review_request(self):
     self.assertEqual(AgileCard.derive_status_from_project(self.project),
                      AgileCard.IN_PROGRESS)