Esempio n. 1
0
    def do_reallocate_person(self, arg):
        ''' Usage: reallocate_person <firstname> <lastname> <new_room_name>'''
        first_name = arg["<firstname>"]
        last_name = arg["<lastname>"]
        full_name = first_name + " " + last_name
        new_room = arg["<new_room_name>"]

        if new_room.upper() in Dojo.office_rooms:
            Dojo.reallocate_person_to_office(full_name.upper(),
                                             new_room.upper())
        elif new_room.upper() in Dojo.ls_rooms:
            Dojo.reallocate_person_to_ls(full_name.upper(), new_room.upper())
        else:
            print('%s is not a room in Dojo' % new_room)
 def test_does_not_reallocate_to_a_full_office_room(self):
     Dojo.create_room('office', 'blue')
     previous_count = len(Dojo.office_rooms['blue'])
     Dojo.add_person('degenez', 'hellen', 'F')
     Dojo.add_person('viona', 'awuor', 'F')
     Dojo.add_person('patrice', 'leah', 'S')
     Dojo.add_person('okindo', 'omutka', 'F')
     Dojo.add_person('liza', 'muli', 'S')
     Dojo.add_person('justin', 'Mzonge', 'S')
     current_count = len(Dojo.office_rooms['blue'])
     self.assertEqual(previous_count + 6, current_count)
     Dojo.create_room('office', 'guantanamo')
     Dojo.add_person('anderson', 'masese', 'F')
     response = Dojo.reallocate_person_to_office('anderson masese', 'blue')
     self.assertEqual(response, 'BLUE is already full')
 def test_does_reallocate_to_same_office_room(self):
     Dojo.create_room('office', 'blue')
     Dojo.add_person('mundi', 'james', 'F')
     response = Dojo.reallocate_person_to_office('mundi james', 'blue')
     self.assertEqual(response, 'MUNDI JAMES is already allocated to blue')