示例#1
0
    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)
示例#2
0
    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())
示例#3
0
    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)
示例#4
0
    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)
示例#5
0
 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
示例#6
0
 def test_remove_potential_schedule(self):
     org = Organizer(self.event, [Schedule()])
     org.remove_potential_schedule(org.potential_schedules[0])
     self.assertFalse(org.potential_schedules)
示例#7
0
    def test_add_potential_schedule(self):
        org = Organizer(self.event)
        schedule = Schedule()

        org.add_potential_schedule(schedule)
        self.assertEqual([schedule], list(org.potential_schedules))