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)
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)
def test_generate_project_cards_twice_has_progress(self): factories.RecruitProjectFactory( recruit_users=[self.user1], content_item=self.content_item, flavours=[JAVASCRIPT], ) generate_and_update_all_cards_for_user(self.user1, None) generate_and_update_all_cards_for_user(self.user1, None) cards = models.AgileCard.objects.all() self.assertEqual(cards.count(), 1) card = cards.first() self.assertIn(self.user1, card.assignees.all())
def setUp(self): self.project_assignee_user = UserFactory(is_superuser=False) self.assignee_team = TeamFactory() self.assignee_team.users.add(self.project_assignee_user) self.project_reviewer_user = UserFactory(is_superuser=False) self.reviewer_team = TeamFactory() self.reviewer_team.users.add(self.project_reviewer_user) self.permissioned_user = UserFactory(is_superuser=False) self.permissioned_team = TeamFactory() self.permissioned_team.users.add(self.permissioned_user) self.project = factories.RecruitProjectFactory( recruit_users=[self.project_assignee_user], reviewer_users=[self.project_reviewer_user], )
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)