示例#1
0
    def test_simple_scheduling(self):

        vol = Volunteer(volunteer_id='v001')

        group = StudentGroup('A')
        sess = Session(week='week2', day='thursday', session_id='s001')
        sess.assign_student_group(group)

        sess.schedule_volunteer(vol)

        self.assertEqual(
            vol.get_groups_seen(), ['A'],
            'volunteer has correctly updated list of groups seen')
        self.assertEqual(vol.get_schedule()['thursday']['week2'], ['s001'],
                         'volunteer schedule updated correctly')
        self.assertEqual(vol.get_times_scheduled(), 1,
                         'correctly counted times scheduled')
        self.assertEqual(vol.get_schedule()['tuesday']['week2'], [],
                         'Tuesday not updated')
示例#2
0
    def test_shceduling_previously_seen_volunteer(self):

        vol = Volunteer(volunteer_id='v001')

        group = StudentGroup('A')

        sess1 = Session(week='week2', day='thursday', session_id='s001')
        sess1.assign_student_group(group)
        sess2 = Session(week='week3', day='tuesday', session_id='s002')
        sess2.assign_student_group(group)

        sess1.schedule_volunteer(vol)
        sess2.schedule_volunteer(vol)

        self.assertEqual(
            vol.get_groups_seen(), ['A'],
            'volunteer has correctly updated list of groups seen')
        self.assertEqual(vol.get_schedule()['thursday']['week2'], ['s001'],
                         'first schedule update successful')
        self.assertEqual(vol.get_schedule()['tuesday']['week3'], [],
                         'second schedule update not successful')