def testMommyEveryoneAttendend(self): G(Attendee, event=self.attendance_event, user=self.user, attended=True) self.attendance_event.marks_has_been_set = False self.attendance_event.automatically_set_marks = True self.event.event_end = timezone.now() - datetime.timedelta(days=1) self.attendance_event.save() self.event.save() SetEventMarks.setMarks(self.attendance_event) self.assertTrue(self.attendance_event.marks_has_been_set) self.assertFalse(MarkUser.objects.all())
def testMommySetMarks(self): self.attendee.attended = False self.attendee.save() self.attendance_event.marks_has_been_set = False self.attendance_event.automatically_set_marks = True self.event.event_end = timezone.now() - datetime.timedelta(days=1) self.attendance_event.save() self.event.save() SetEventMarks.setMarks(self.attendance_event) self.assertTrue(self.attendance_event.marks_has_been_set) self.assertEqual(self.user, MarkUser.objects.get().user)
def testMommyEventNotDone(self): self.attendance_event.marks_has_been_set = False self.attendance_event.automatically_set_marks = True self.event.event_end = timezone.now() + datetime.timedelta(days=1) self.attendance_event.save() self.event.save() self.assertFalse(SetEventMarks.active_events())
def testMommyActiveEvents(self): self.attendance_event.event.event_end = timezone.now( ) - datetime.timedelta(days=1) self.attendance_event.event.save() self.attendance_event.marks_has_been_set = False self.attendance_event.automatically_set_marks = True self.attendance_event.save() self.assertEqual(self.attendance_event, SetEventMarks.active_events()[0])
def testMommyGenerateEmptyMessage(self): G(Attendee, event=self.attendance_event, user=self.user, attended=True) self.attendance_event.marks_has_been_set = False self.attendance_event.automatically_set_marks = True self.event.event_end = timezone.now() - datetime.timedelta(days=1) self.attendance_event.save() self.event.save() message = SetEventMarks.generate_message(self.attendance_event) self.assertFalse(message.send) self.assertFalse(message.results_message)
def testMommyGenerateMessage(self): self.attendee.attended = False self.attendee.save() self.attendance_event.marks_has_been_set = False self.attendance_event.automatically_set_marks = True self.event.event_end = timezone.now() - datetime.timedelta(days=1) self.attendance_event.save() self.event.save() message = SetEventMarks.generate_message(self.attendance_event) self.assertTrue(message.send) self.assertTrue(message.committee_message)