def test_confirm_schedule(self): schedule_a = Schedule() org = Organizer(self.event, [schedule_a]) self.assertEqual(None, org.schedule) org.confirm_schedule(schedule_a) self.assertEqual(schedule_a, org.schedule)
def test_get_best_schedule(self): schedule_a = Schedule() schedule_b = Schedule() schedule_a.add_time(TimeRange.now()) schedule_b.add_time(TimeRange.now()) org = Organizer(self.event, [schedule_a, schedule_b]) org.vote(self.invited_member, schedule_b) self.assertEqual(schedule_b, org.get_best_schedule())
def test_vote_invalid_member(self): schedule_a = Schedule() schedule_b = Schedule() schedule_a.add_time(TimeRange.now()) schedule_b.add_time(TimeRange.now()) org = Organizer(self.event, [schedule_a, schedule_b]) func = partial(org.vote, self.uninvited_member, schedule_a) self.assertRaises(PermissionError, func) self.assertEqual({}, org.votes)
def test_vote_change(self): schedule_a = Schedule() schedule_b = Schedule() schedule_a.add_time(TimeRange.now()) schedule_b.add_time(TimeRange.now()) org = Organizer(self.event, [schedule_a, schedule_b]) org.vote(self.invited_member, schedule_b) org.vote(self.invited_member, schedule_a) self.assertEqual({self.invited_member: set([schedule_a])}, org.votes)
def __init__(self, report=None, state=State.UNSENT, schedule=None, last_send=None): super().__init__(report, state) self.report = report self.schedule = schedule or Schedule.now() self.last_send = last_send
def test_remove_potential_schedule(self): org = Organizer(self.event, [Schedule()]) org.remove_potential_schedule(org.potential_schedules[0]) self.assertFalse(org.potential_schedules)
def test_add_potential_schedule(self): org = Organizer(self.event) schedule = Schedule() org.add_potential_schedule(schedule) self.assertEqual([schedule], list(org.potential_schedules))