def setUp(self): self.staff_user = StaffUserFactory() self.simple_user = UserFactory() MembersModel.objects.create(user=self.staff_user, project=self.project1, joined_date=today()) MembersModel.objects.create(user=self.simple_user, project=self.project1, joined_date=today()) MembersModel.objects.create(user=self.simple_user, project=self.project2, joined_date=today())
def is_assessment(self) -> bool: from ssm.assessments.models import Assessment assessment_notificaiton = self.assessment_notification if self.assessment_notification else None return Assessment.objects.filter( user=self, end_date=today()) and assessment_notificaiton != today()
def is_birthday(self) -> bool: date_of_birth = self.date_of_birth if self.date_of_birth else None birthday_notification = self.birthday_notification if self.birthday_notification else None return date_of_birth == today() and birthday_notification != today()
def test_is_birthday__false__already_notified(self): self.user.date_of_birth = today() self.user.birthday_notification = today() assert not self.user.is_birthday()
def test_is_birthday__true(self): self.user.date_of_birth = today() assert self.user.is_birthday()