class AmityTestReallocatePerson(unittest.TestCase):
    """This class contains tests for the reallocate_person function"""
    def setUp(self):
        "Setup for class initializations"
        self.amity = Amity()

    def test_if_person_name_exists_before_reallocation(self):
        "Tests if the person name exists so as to reallocate the person"
        people_list = []
        self.amity.create_room(['SHIRE', 'OFFICE'])
        self.amity.create_room(['RUBY', 'LIVING_SPACE'])
        self.amity.add_person('Charles', 'Mac', 'Fellow', 'Y')
        self.amity.reallocate_person('Charles', 'Mac', 'SHIRE')
        for person in self.amity.all_people:
            person_name = person.name
            people_list.append(person_name)
        self.assertTrue('Charles Mac' in people_list)

    def test_if_office_exists_before_reallocation(self):
        office_list = []
        self.amity.create_room(['SHIRE', 'OFFICE'])
        self.amity.add_person('Charles', 'Mac', 'Fellow', 'Y')
        self.amity.reallocate_person('Charles', 'Mac', 'SHIRE')
        for office in self.amity.all_rooms_office:
            room_name = office.room_name
            office_list.append(room_name)
        self.assertTrue('SHIRE' in office_list)
class AmityTestAddPerson(unittest.TestCase):
    """ This class tests all cases associated with add_person function """
    def setUp(self):
        "Setup for class initializations"
        self.amity = Amity()

    def test_add_person(self):
        "Test that person is added"
        add_person = self.amity.add_person('Charles', 'Mac', 'Fellow', 'Y')
        self.assertEqual(add_person,
                         'Please create offices and living_spaces first.')
        self.amity.create_room(['SHIRE', 'OFFICE'])
        self.amity.create_room(['RUBY', 'LIVING_SPACE'])
        self.amity.add_person('Charles', 'Mac', 'STAFF', 'N')
        self.assertEqual(len(self.amity.all_people), 1)

    def test_if_person_exists(self):
        "Test if the person exists"
        self.amity.create_room(['SHIRE', 'OFFICE'])
        self.amity.create_room(['RUBY', 'LIVING_SPACE'])
        add_person = self.amity.add_person('Charles', 'Mac', 'Fellow', 'Y')
        add_person = self.amity.add_person('Charles', 'Mac', 'Fellow', 'Y')
        self.assertEqual(add_person, 'Another user exists with the same name')

    def test_add_person_with_accomodation_when_no_rooms_have_been_created(
            self):
        "Tests if there are living rooms and offices before adding a fellow who wants accomodation"
        add_person = self.amity.add_person('Charles', 'Mac', 'Fellow', 'Y')
        self.assertEqual(add_person,
                         'Please create offices and living_spaces first.')

    def test_add_person_with_accomodation_when_no_rooms_have_been_created(
            self):
        "Tests if there are offices before adding a fellow without accomodation"
        add_person = self.amity.add_person('Charles', 'Mac', 'Fellow', 'N')
        self.assertEqual(add_person, 'Please create offices first.')

    def test_rejects_when_staff_wants_accomodation(self):
        "Tests if the system denies staff accomodation."
        self.amity.create_room(['SHIRE', 'OFFICE'])
        self.amity.create_room(['RUBY', 'LIVING_SPACE'])
        add_person = self.amity.add_person('Charles', 'Mac', 'STAFF', 'Y')
        self.assertEqual(add_person, 'No accomodation for staff')

    def test_if_optional_args_for_wants_accomodation_is_valid(self):
        "Tests if optional argument for add_person is Y or N"
        self.amity.create_room(['SHIRE', 'OFFICE'])
        self.amity.create_room(['RUBY', 'LIVING_SPACE'])
        add_person = self.amity.add_person('Charles', 'Mac', 'STAFF', 'R')
        self.assertEqual(add_person, 'No such option. Use either Y or N')

    def test_if_person_role_is_valid(self):
        "Tests if the role is either staff or fellow "
        self.amity.create_room(['SHIRE', 'OFFICE'])
        self.amity.create_room(['RUBY', 'LIVING_SPACE'])
        add_person = self.amity.add_person('Charles', 'Mac', 'STAF', 'N')
        self.assertEqual(add_person, 'Your role is undefined')
Beispiel #3
0
class TestAmity(unittest.TestCase):
    """ Test amity """
    def setUp(self):
        self.amity = Amity()
        self.offices = self.amity.offices
        self.living_spaces = self.amity.living_spaces
        self.fellows = self.amity.fellows
        self.staff = self.amity.staff
        self.new_offices = self.amity.create_room("O", "Occulus", "Narnia")
        self.new_living_space = self.amity.create_room("L", 'mombasa')
        self.new_fellow = self.amity.add_person("hum", "musonye", "fellow", "Y")
        self.new_staff = self.amity.add_person("hum", "musonye", "staff", "N")
        self.unallocated_fellows = self.amity.unallocated_fellow
        self.unallocated_staff = self.amity.unallocated_staff

    def test_create_living_space(self):
        """ Tests whether a livingspace(room) is created. """
        initial_room_count = len(self.living_spaces)
        self.amity.create_room("L", 'php')
        new_room_count = len(self.living_spaces)

        self.assertEqual(new_room_count, initial_room_count + 1)

    def test_create_office(self):
        """ Tests whether an office(room) is created. """
        initial_room_count = len(self.offices)
        self.amity.create_room("O", "Camelot")
        new_room_count = len(self.offices)

        self.assertEqual(new_room_count, initial_room_count + 1)

    def test_create_multiple_rooms(self):
        """ Tests whether multiple rooms can be created. """
        initial_room_count = len(self.living_spaces)
        self.amity.create_room("L", "Scalar", "Laravel")
        new_room_count = len(self.living_spaces)

        self.assertEqual(new_room_count, initial_room_count + 2)

    def test_room_already_exists(self):
        """ Test behaiviour of create room, when you create an already existing room """
        self.new_living_space
        msg = self.amity.create_room("L", "mombasa")

        self.assertEqual("Room Already Exists!", msg)

    def test_invalid_room_type(self):
        """ Tests whether message is return when invalid room type param is passed"""
        new_room = self.amity.create_room("S", "Laravel")
        self.assertEqual(new_room, "Inavlid Room Type!")

    def test_vacant_rooms_returned(self):
        """ Tests whether rooms that have remaining slots are returned. """
        new_room = Office('mombasa')
        self.amity.check_vacant_rooms()
        vacant_status = new_room.is_full()

        self.assertFalse(vacant_status)

    def test_is_full_returns_true(self):
        """ Tests whether the system knows when a room is fully occupied. """
        new_room = Office('mombasa')
        new_room.occupants.append(136648)
        new_room.occupants.append(136650)
        new_room.occupants.append(136651)
        new_room.occupants.append(136652)
        new_room.occupants.append(136653)
        new_room.occupants.append(136654)
        vacant_status = new_room.is_full()

        self.assertTrue(vacant_status)

    def test_is_full_returns_false(self):
        """ Tests whether the system knows when a room is not fully occupied. """
        new_room = Office('mombasa')
        new_room.occupants.append(136648)
        new_room.occupants.append(136650)
        new_room.occupants.append(136651)
        vacant_status = new_room.is_full()

        self.assertFalse(vacant_status)

    def test_add_fellow(self):
        """ Tests if a fellow is added successfully added. """
        new_fellow = self.new_fellow

        self.assertEqual("Person Created Successfully!", new_fellow)

    def test_add_staff(self):
        """ Tests if a staff is added successfully added """
        new_staff = self.new_staff

        self.assertEqual("Person Created Successfully!", new_staff)

    def test_new_fellow_in_unallocated(self):
        """ Tests whether a newly created fellow is saved to the unallocated list. """
        unallocated_status = True if len(self.unallocated_fellows) > 0 else False

        self.assertTrue(unallocated_status)

    def test_new_staff_in_unallocated(self):
        """ Tests whether a newly created staff is saved to the unallocated list. """
        unallocated_status = True if len(self.unallocated_staff) > 0 else False

        self.assertTrue(unallocated_status)

    def test_allocate_staff(self):
        """ Tests whether a new staff member is allocated an office. """
        staff = self.staff[-1]
        self.amity.allocate_person(str(staff.employee_id))
        unallocated_length = len(self.unallocated_staff)

        self.assertEqual(0, unallocated_length)

    def test_allocate_fellow(self):
        """ Tests whether a new fellow is allocated an office and livingspace. """
        fellow = self.fellows[-1]
        self.amity.allocate_person(str(fellow.employee_id))
        unallocated_length = len(self.unallocated_fellows)

        self.assertEqual(0, unallocated_length)

    def test_if_person_not_found(self):
        """ Tests whether a non-existent person can be allocated a room. """
        non_existent_person = 1000001
        allocated_status = self.amity.allocate_person(str(non_existent_person))

        self.assertEqual("Person not found!", allocated_status)

    def test_if_livingspaces_not_found(self):
        """ Test whether allocate_person works when no living_spaces are created. """
        fellow = self.fellows[-1]
        self.amity.living_spaces = []
        allocated_msg = self.amity.allocate_person(str(fellow.employee_id))

        self.assertIn("LivingSpace not available!", allocated_msg)

    def test_if_offices_not_found(self):
        """ Test whether allocate_person works when no offices are created. """
        fellow = self.fellows[-1]
        self.amity.offices = []
        allocated_msg = self.amity.allocate_person(str(fellow.employee_id))

        self.assertIn("Office not available!", allocated_msg)

    def test_when_staff_wants_lspace(self):
        """
        Tests whether the system returns an error message when
        Staff wants_accomodation = Y
        """
        self.amity.add_person("alexis", "sanchez", "staff", "Y")
        staff = self.staff[-1]
        allocated_msg = self.amity.allocate_person(str(staff.employee_id))

        self.assertIn("Cannot assign LivingSpace to staff!", allocated_msg)

    def test_reallocate_if_person_not_found(self):
        """ Tests whether a non-existent person can be reallocated to a room. """
        non_existent_person = 1000001
        allocated_status = self.amity.reallocate_person(str(non_existent_person), 'mombasa')

        self.assertEqual("Person not found", allocated_status)

    def test_if_new_room_name_exists(self):
        """ Test whether reallocate_person finds new_room_name. """
        fellow = self.fellows[-1]
        self.amity.allocate_person(str(fellow.employee_id))
        reallocated_status = self.amity.reallocate_person(str(fellow.employee_id), 'mogadishu')

        self.assertEqual("Room does not Exist!", reallocated_status)

    def test_reallocate_lspace(self):
        """ Test whether a person can be reallocated from one room to another. """
        fellow = self.fellows[-1]
        self.amity.allocate_person(str(fellow.employee_id))

        self.amity.create_room("L", 'kilifi')

        reallocated_status = self.amity.reallocate_person(str(fellow.employee_id), 'kilifi')

        self.assertIn("Successfully Reallocated", reallocated_status)

    def test_reallocate_office(self):
        """ Test whether a person can be reallocated from one room to another. """
        fellow = self.fellows[-1]
        self.amity.allocate_person(str(fellow.employee_id))

        self.amity.create_room("O", 'kilaguni')

        reallocated_status = self.amity.reallocate_person(str(fellow.employee_id), 'kilaguni')

        self.assertIn("Successfully Reallocated", reallocated_status)

    def test_staff_reallocated_lspace(self):
        """
        Test that error message is returned when staff is reallocated to \
        LivingSpace
        """
        staff = self.staff[-1]
        self.amity.allocate_person(str(staff.employee_id))

        reallocated_status = self.amity.reallocate_person(str(staff.employee_id), 'mombasa')

        self.assertIn("Cannot reallocate staff to livingspace!", reallocated_status)

    def test_load_people(self):
        """ Test whether load_people adds people to room from a text file. """
        self.amity.fellows = []
        self.amity.load_people("people")

        self.assertTrue(self.amity.fellows)

    def test_load_people_from_non_existent_file(self):
        """ Tests whether people can be loaded from a non-existent file. """
        load_people = self.amity.load_people("persons")

        self.assertEqual("File: persons, Not Found!", load_people)

    def test_allocations_outputs_file(self):
        """ Tests whether allocations can be printed on file: new_allocations. """
        staff = self.staff[-1]
        self.amity.allocate_person(str(staff.employee_id))
        self.amity.print_allocations("new_allocations")
        file_path = os.path.abspath("data/new_allocations.txt")
        file_status = os.path.isfile(file_path)

        self.assertTrue(file_status)

    def test_allocations_outputs_screen(self):
        """ Tests whether allocations can be printed on file: new_allocations. """
        staff = self.staff[-1]
        self.amity.allocate_person(str(staff.employee_id))
        data = self.amity.print_allocations()

        self.assertTrue(data)

    def test_output_when_no_room(self):
        """ Test print_allocations when no rooms in the system """
        self.amity.offices = []
        self.amity.living_spaces = []

        data = self.amity.print_allocations()

        self.assertIn("No Rooms Found.", data)

    def test_output_to_file(self):
        """ Tests whether the unallocated can be printed on file: new_unallocated. """
        staff = self.staff[-1]
        self.amity.allocate_person(str(staff.employee_id))
        self.amity.print_unallocated("new_unallocated")
        file_path = os.path.abspath("data/new_unallocated.txt")
        file_status = os.path.isfile(file_path)

        self.assertTrue(file_status)

    def test_unallocated_outputs_screen(self):
        """ Tests whether the unallocated can be printed on file: new_unallocated. """
        staff = self.staff[-1]
        self.amity.allocate_person(str(staff.employee_id))
        data = self.amity.print_unallocated()

        self.assertTrue(data)

    def test_print_non_existent_room(self):
        """ Test whether a non-existent room can be printed on screen. """
        print_room = self.amity.print_room("arkham")

        self.assertIn("Room not found!", print_room)

    def test_when_no_occupants_in_room(self):
        """ Test whether a room with no occupants can be printed on screen. """
        print_room = self.amity.print_room("mombasa")

        self.assertIn("No occupants in room", print_room)

    def test_print_correct_occupants(self):
        """ Test whether a room and its occupants can be printed on screen. """
        fellow = self.fellows[-1]
        self.amity.allocate_person(str(fellow.employee_id))
        print_room = self.amity.print_room("mombasa")

        self.assertIn("Hum Musonye", print_room)

    def test_save_state_creates_db(self):
        """ Test whether save_state creates a SQLite database. """
        self.amity.save_state("test")
        file_path = os.path.abspath("test.db")
        file_status = os.path.isfile(file_path)

        self.assertTrue(file_status)

    def test_non_existent_db(self):
        """ Tests how load_state behaves when passed a nn existent db name. """
        load_state = self.amity.load_state("amity_lagos")

        self.assertEqual("Database amity_lagos.db not found!", load_state)

    def test_load_test(self):
        """ Test whether load_state persists data from db to amity system. """
        self.amity.add_person("bat", "man", "fellow", "Y")
        self.amity.save_state("test_load")
        self.amity.load_state("test_load")

        is_loaded = True if len(self.amity.fellows) > 1 else False

        self.assertTrue(is_loaded)
Beispiel #4
0
class AmityTest(unittest.TestCase):

    def setUp(self):
        self.amity = Amity()
        self.fellow = Fellow()
        self.Staff = Staff()
        self.office = Office()
        self.livingspace = LivingSpace()

    def test_add_person_fellow(self):
        self.amity.fellows = [{"id":"F16", "name":"Maryanne Waceke","role":"fellow" ,"office":"camelot"}]
        original_length = len(self.amity.fellows)
        self.amity.add_person("Jake", "Mwai", "fellow", "yes")
        self.assertTrue(len(self.amity.fellows) > original_length)

    def test_add_person_staff(self):
        self.amity.staff = []
        original_length = len(self.amity.staff)
        self.amity.add_person("Sally", "Irungu", "staff")
        self.assertTrue(len(self.amity.staff) > original_length)

    def test_add_person_takes_either_role_of_staff_or_fellow(self):
        self.amity.staff = []
        original_length = len(self.amity.staff)
        self.assertEqual(self.amity.add_person("harry", "kimani", 2), "Please enter valid role.")

    def test_add_person_takes_either_yes_or_no_for_wants_accomodaton(self):
        self.amity.fellows = []
        original_length = len(self.amity.fellows)
        with self.assertRaises(ValueError):
            self.amity.add_person("harry", "kimani", "fellow", 3)

    def test_add_person_does_not_allocate_staff_accomodation(self):
        self.amity.staff = []
        original_length = len(self.amity.staff)
        self.amity.add_person("Stella", "Murimi", "staff", "yes")
        self.assertEqual(self.amity.staff[0]["living_space"], None)

    def test_create_room_one_room(self):
        self.amity.offices = []
        original_length = len(self.amity.offices)
        self.amity.create_room("living_space", "narnia")
        self.assertTrue(len(self.amity.offices) > original_length)

    def test_create_room_more_rooms(self):
        self.amity.offices = []
        original_length = len(self.amity.offices)
        self.amity.create_room("living_space", "narnia", "topaz", "emerald")
        self.assertEqual(len(self.amity.offices), original_length+3)

    def test_create_room_takes_either_living_space_or_office_for_type(self):
        # self.amity.offices = [{"name": "camelot", "no_of_members": 1, "max_members": 6}]
        # self.amity.living_spaces = [{"name": "emerald", "no_of_members": 1, "max_members": 4}]
        # offices_original_length = len(self.amity.offices)
        # living_spaces_original_length = len(self.amity.living_spaces)
        # self.amity.create_room("sitting_room", "topaz")
        # self.assertEqual(len(self.amity.offices), offices_original_length)
        self.assertEqual(self.amity.create_room("sitting_room", "narnia"),"Please input valid room type")

    def test_create_room_only_takes_strings_as_room_names(self):
        self.assertEqual(self.amity.create_room("office", 1, 2), "Please enter valid room names.")

    # def test_allocate_office(self):
    #     pass
    def test_allocate_living_space_works(self):
        self.amity.living_spaces = [
            {"name": "emerald", "no_of_members": 1, "max_members": 4}]
        original_occupants = self.amity.living_spaces[0]["no_of_members"]
        self.amity.allocate_living_space("F120", "emerald")
        self.assertTrue(
            self.amity.living_spaces[0]["no_of_members"] > original_occupants)

    def test_allocate_living_space_doesnt_allocate_staff(self):
        # self.amity.living_spaces = [
        #     {"name": "emerald", "no_of_members": 1, "max_members": 4}]
        # original_occupants = self.amity.living_spaces[0]["no_of_members"]
        # self.amity.allocate_living_space("S12", "emerald")
        # self.assertEqual(
        #     self.amity.living_spaces[0]["no_of_members"], original_occupants)
        self.assertEqual(self.amity.allocate_living_space("S12", "emerald"), "Staff cannot be allocated living space.")


    def test_allocate_living_space_doesnt_allocate_beyond_maximum(self):
        self.amity.living_spaces = [
            {"name": "emerald", "no_of_members": 4, "max_members": 4}]
        # original_occupants = self.amity.living_spaces[0]["no_of_members"]
        # self.amity.allocate_living_space("F120", "emerald")
        # self.assertEqual(
        #     self.amity.living_spaces[0]["no_of_members"], original_occupants)
        self.assertEqual(self.amity.allocate_living_space("F120", "emerald"), "Room full.")

    def test_reallocate_office_works(self):
        self.amity.offices = [{"name": "camelot", "no_of_members": 1, "max_members": 6}, {
            "name": "hogwarts", "no_of_members": 0, "max_members": 6}]
        self.amity.fellows = [{"id":"F16", "name":"Maryanne Waceke","role":"fellow" ,"office":"camelot"}]
        original_camelot_occupants = self.amity.offices[0]["no_of_members"]
        original_hogwarts_occupants = self.amity.offices[1]["no_of_members"]
        self.amity.reallocate_office("F16", "hogwarts")
        self.assertTrue(self.amity.offices[0]["no_of_members"]<original_camelot_occupants)
        self.assertTrue(self.amity.offices[1]["no_of_members"]>original_hogwarts_occupants)
Beispiel #5
0
class ScreenOut(cmd.Cmd):
    """main class"""

    os.system('clear')
    fig_font = Figlet(font='poison', justify='left', width=200)
    print("\n")
    print(colored(fig_font.renderText('( AMITY )'),\
         'green', attrs=['bold']))

    intro = colored('Version 1.0\t\t Enter "quit" to exit \n',
                    'green',
                    attrs=['bold'])

    nice = colored('(amity) ~ ', 'cyan', attrs=['blink'])
    prompt = nice

    def __init__(self):
        cmd.Cmd.__init__(self)
        self.amity = Amity()

    @docopt_cmd
    def do_create_room(self, args):
        """Usage: create_room <room_type> <room_name>..."""
        room_type = args['<room_type>']
        room_names = args['<room_name>']

        msg = self.amity.create_room(room_type, *room_names)
        if "!" in msg:
            msg += '  ✘'
            msg = colored(msg, 'red', attrs=['bold', 'dark'])
            print(msg)
        else:
            msg += '  ✔'
            msg = colored(msg, 'green', attrs=['bold', 'dark'])
            print(msg)

    @docopt_cmd
    def do_add_person(self, args):
        """Usage: add_person <fname> <lname> <role> [<wants_accomodation>]"""
        fname = args['<fname>']
        lname = args['<lname>']
        role = args['<role>']
        wants_accomodation = args['<wants_accomodation>']

        try:
            if wants_accomodation.upper() not in ['Y', 'N']:
                msg = "Invalid accomodation parameter! Please use Y or N  ✘"
                msg = colored(msg, 'red', attrs=['bold', 'dark'])
                print(msg)

            if role.upper() not in ['FELLOW', 'STAFF']:
                msg = "Invalid role parameter! Please use FELLOW or STAFF  ✘"
                msg = colored(msg, 'red', attrs=['bold', 'dark'])
                print(msg)

            else:
                msg = self.amity.add_person(fname, lname, role,
                                            wants_accomodation)
                msg += '  ✔'
                msg = colored(msg, 'green', attrs=['bold', 'dark'])
                print(msg)

        except AttributeError:
            msg = "Please indicate if person wants accomodation!  ✘"
            msg = colored(msg, 'red', attrs=['bold', 'dark'])
            print(msg)

    @docopt_cmd
    def do_allocate_person(self, args):
        """Usage: allocate_person <person_id>"""
        person_id = args['<person_id>']
        msg = self.amity.allocate_person(person_id)
        if "!" not in msg:
            msg += '  ✔'
            msg = colored(msg, 'yellow', attrs=['bold', 'dark'])
            print(msg)
        else:
            msg = colored(msg, 'green', attrs=['bold', 'dark'])
            print(msg)

    @docopt_cmd
    def do_reallocate_person(self, args):
        """Usage: reallocate_person <person_id> <new_room_name>"""
        person_id = args['<person_id>']
        room = args['<new_room_name>']
        msg = self.amity.reallocate_person(person_id, room)
        if "!" in msg:
            msg += '  ✘'
            msg = colored(msg, 'red', attrs=['bold', 'dark'])
            print(msg)
        else:
            msg += '  ✔'
            msg = colored(msg, 'green', attrs=['bold', 'dark'])
            print(msg)

    @docopt_cmd
    def do_load_people(self, arg):
        """Usage: load_people"""
        msg = self.amity.load_people('people')
        if "!" in msg:
            msg += '  ✘'
            msg = colored(msg, 'red', attrs=['bold', 'dark'])
            print(msg)
        else:
            msg += '  ✔'
            msg = colored(msg, 'green', attrs=['bold', 'dark'])
            print(msg)

    @docopt_cmd
    def do_print_allocations(self, args):
        """Usage: print_allocations [--o=filename.txt]"""
        if args['--o']:
            filename = args['--o']
            msg = self.amity.print_allocations(filename)
            if "!" in msg:
                msg += '  ✘'
                msg = colored(msg, 'red', attrs=['bold', 'dark'])
                print(msg)
            else:
                msg += '  ✔'
                msg = colored(msg, 'green', attrs=['bold', 'dark'])
                print(msg)
        else:
            msg = self.amity.print_allocations()
            if "!" in msg:
                msg += '  ✘'
                msg = colored(msg, 'red', attrs=['bold', 'dark'])
                print(msg)
            else:
                msg = colored(msg, 'yellow', attrs=['bold', 'dark'])
                print(msg)

    @docopt_cmd
    def do_print_unallocated(self, args):
        """Usage: print_unallocated [--o=filename.txt]"""
        if args['--o']:
            filename = args['--o']
            msg = self.amity.print_unallocated(filename)
            if "!" in msg:
                msg += '  ✘'
                msg = colored(msg, 'red', attrs=['bold', 'dark'])
                print(msg)
            else:
                msg += '  ✔'
                msg = colored(msg, 'green', attrs=['bold', 'dark'])
                print(msg)
        else:
            msg = self.amity.print_unallocated()
            if "!" in msg:
                msg += '  ✘'
                msg = colored(msg, 'red', attrs=['bold', 'dark'])
                print(msg)
            else:
                msg = colored(msg, 'yellow', attrs=['bold', 'dark'])
                print(msg)

    @docopt_cmd
    def do_print_room(self, args):
        """Usage: print_room <room_name>"""
        room_name = args['<room_name>']
        msg = self.amity.print_room(room_name)

        if "!" in msg:
            msg += '  ✘'
            msg = colored(msg, 'red', attrs=['bold', 'dark'])
            print(msg)
        else:
            msg += '  ✔'
            msg = colored(msg, 'yellow', attrs=['bold', 'dark'])
            print(msg)

    @docopt_cmd
    def do_save_state(self, args):
        """Usage: save_state [--db=sqlite_database]"""
        db = args['--db']
        msg = self.amity.save_state(db)
        if "!" in msg:
            msg += '  ✘'
            msg = colored(msg, 'red', attrs=['bold', 'dark'])
            print(msg)
        else:
            msg += '  ✔'
            msg = colored(msg, 'green', attrs=['bold', 'dark'])
            print(msg)

    @docopt_cmd
    def do_load_state(self, args):
        """Usage: load_state [<sqlite_database>]"""
        db = args['<sqlite_database>']
        msg = self.amity.load_state(db)
        if "!" in msg:
            msg += '  ✘'
            msg = colored(msg, 'red', attrs=['bold', 'dark'])
            print(msg)
        else:
            msg = colored(msg, 'green', attrs=['bold', 'dark'])
            print(msg)

    def do_quit(self, arg):
        """Quits out of Interactive Mode."""

        os.system('clear')
        bye = Figlet(font='jazmine')
        delay_print('\n\n' + \
                colored(bye.renderText('Bye ...'), 'yellow', attrs=['bold']))
        exit()