class RoomPersonTestCase(unittest.TestCase):
    """ test the instantiation of rooms and people """
    def setup(self):
        self.office = Office()
        self.living = LivingSpace()
        self.office.populate_room_names()
        self.living.populate_room_names()
        self.f = Person.create('Jee Gikera', 'fellow', wants_accomodation=True)
        self.staff = Person.create('Chidi Nnadi', 'staff')

    def test_room_creation(self):
        """ generate rooms and test their specs """
        self.office = Office('TopOffice')
        self.living = LivingSpace('WoodWing')
        office_size = self.office.capacity
        living_size = self.living.capacity
        self.assertEquals(office_size, 6)
        self.assertEquals(living_size, 4)
        self.assertIsInstance(self.office, Office)
        self.assertIsInstance(self.living, LivingSpace)

    def test_person_creation(self):
        """ create employees and test against their class instances """
        self.fellow = Person.create('Jee Gikera',
                                    'fellow',
                                    wants_accomodation=True)
        self.staff = Person.create('Chidi Nnadi', 'staff')
        self.assertIsInstance(self.fellow, Fellow)
        self.assertIsInstance(self.staff, Staff)
 def setup(self):
     self.office = Office()
     self.living = LivingSpace()
     self.office.populate_room_names()
     self.living.populate_room_names()
     self.f = Person.create('Jee Gikera', 'fellow', wants_accomodation=True)
     self.staff = Person.create('Chidi Nnadi', 'staff')
class RoomPersonTestCase(unittest.TestCase):
    """ test the instantiation of rooms and people """

    def setup(self):
        self.office = Office()
        self.living = LivingSpace()
        self.office.populate_room_names()
        self.living.populate_room_names()
        self.f = Person.create(
            'Jee Gikera', 'fellow', wants_accomodation=True)
        self.staff = Person.create('Chidi Nnadi', 'staff')

    def test_room_creation(self):
        """ generate rooms and test their specs """
        self.office = Office('TopOffice')
        self.living = LivingSpace('WoodWing')
        office_size = self.office.capacity
        living_size = self.living.capacity
        self.assertEquals(office_size, 6)
        self.assertEquals(living_size, 4)
        self.assertIsInstance(self.office, Office)
        self.assertIsInstance(self.living, LivingSpace)

    def test_person_creation(self):
        """ create employees and test against their class instances """
        self.fellow = Person.create(
            'Jee Gikera', 'fellow', wants_accomodation=True)
        self.staff = Person.create('Chidi Nnadi', 'staff')
        self.assertIsInstance(self.fellow, Fellow)
        self.assertIsInstance(self.staff, Staff)
 def test_room_creation(self):
     """ generate rooms and test their specs """
     self.office = Office('TopOffice')
     self.living = LivingSpace('WoodWing')
     office_size = self.office.capacity
     living_size = self.living.capacity
     self.assertEquals(office_size, 6)
     self.assertEquals(living_size, 4)
     self.assertIsInstance(self.office, Office)
     self.assertIsInstance(self.living, LivingSpace)
Esempio n. 5
0
 def add_rooms(self, room_list, room_type):
     """ Instantiate offices and store them in a list """
     if room_type.lower() == 'office':
         room_list = [Office(room_name) for room_name in room_list]
     elif room_type.lower() == 'living':
         room_list = [LivingSpace(room_name) for room_name in room_list]
     return room_list
 def setup(self):
     self.office = Office()
     self.living = LivingSpace()
     self.office.populate_room_names()
     self.living.populate_room_names()
     self.f = Person.create(
         'Jee Gikera', 'fellow', wants_accomodation=True)
     self.staff = Person.create('Chidi Nnadi', 'staff')
 def test_room_creation(self):
     """ generate rooms and test their specs """
     self.office = Office('TopOffice')
     self.living = LivingSpace('WoodWing')
     office_size = self.office.capacity
     living_size = self.living.capacity
     self.assertEquals(office_size, 6)
     self.assertEquals(living_size, 4)
     self.assertIsInstance(self.office, Office)
     self.assertIsInstance(self.living, LivingSpace)
    def test_allocation_to_rooms(self):
        """ tests the allocation of persons to rooms """
        self.fellow = Person.create(
            'Jee Gikera', 'fellow', wants_accomodation='Y')
        self.staff = Person.create('Chidi Nnadi', 'staff')
        office_room = Office('valhalla')
        living_room = LivingSpace('blue')
        # store person instances for testing
        fellow_only.append(self.fellow)
        persons.append(self.staff)
        persons.append(self.fellow)

        office_results = self.staff.assign_office_space(office_room)
        living_results = self.fellow.assign_living_space(living_room)
        office_room.assign_person(self.staff)
        living_room.assign_person(self.fellow)
        self.assertTrue(self.staff.has_office())
        self.assertTrue(self.fellow.has_living_space())
        self.assertIsInstance(office_results, Office)
        self.assertIsInstance(living_results, LivingSpace)
        self.assertIsNotNone(living_room)
        self.assertIsNotNone(office_room)
        self.assertFalse(living_room.is_occupied())
        self.assertFalse(office_room.is_occupied())
        self.office = Office('GreenHouse')
        self.living = LivingSpace('BlueMoon')
        self.amity = Amity()

        ospace = self.amity.allocate_office_space(self.fellow)
        lspace = self.amity.allocate_living_space(self.fellow)
        allocated = self.office.get_occupants()
        self.assertEquals(self.staff.has_living_space(), False)
        self.assertEquals(self.fellow.has_living_space(), True)
        self.assertIsNotNone(allocated)
        self.assertIsNotNone(ospace)
        self.assertIsNotNone(lspace)
    def test_allocation_to_rooms(self):
        """ tests the allocation of persons to rooms """
        self.fellow = Person.create('Jee Gikera',
                                    'fellow',
                                    wants_accomodation='Y')
        self.staff = Person.create('Chidi Nnadi', 'staff')
        office_room = Office('valhalla')
        living_room = LivingSpace('blue')
        # store person instances for testing
        fellow_only.append(self.fellow)
        persons.append(self.staff)
        persons.append(self.fellow)

        office_results = self.staff.assign_office_space(office_room)
        living_results = self.fellow.assign_living_space(living_room)
        office_room.assign_person(self.staff)
        living_room.assign_person(self.fellow)
        self.assertTrue(self.staff.has_office())
        self.assertTrue(self.fellow.has_living_space())
        self.assertIsInstance(office_results, Office)
        self.assertIsInstance(living_results, LivingSpace)
        self.assertIsNotNone(living_room)
        self.assertIsNotNone(office_room)
        self.assertFalse(living_room.is_occupied())
        self.assertFalse(office_room.is_occupied())
        self.office = Office('GreenHouse')
        self.living = LivingSpace('BlueMoon')
        self.amity = Amity()

        ospace = self.amity.allocate_office_space(self.fellow)
        lspace = self.amity.allocate_living_space(self.fellow)
        allocated = self.office.get_occupants()
        self.assertEquals(self.staff.has_living_space(), False)
        self.assertEquals(self.fellow.has_living_space(), True)
        self.assertIsNotNone(allocated)
        self.assertIsNotNone(ospace)
        self.assertIsNotNone(lspace)
Esempio n. 10
0
from employees.model import Person, Fellow, Staff
from rooms.models import LivingSpace, Office

# file path to the input .txt file containing people
file_path = 'input.txt'
persons = []
fellow_only = []

# a list of living space
living_spaces = [
    'green', 'blue', 'yellow', 'lilac', 'orange', 'white', 'brown',
    'turquoise', 'grey', 'purple'
]
# create the office list
livings_list = [
    LivingSpace(living_space_name) for living_space_name in living_spaces
]

# a list of offices
office_spaces = [
    "allegro", "boma", "valhalla", "hogwarts", "krypton", "oculus", "gondolla",
    "amitoid", "punta", "borabora"
]


class RoomPersonTestCase(unittest.TestCase):
    """ test the instantiation of rooms and people """
    def setup(self):
        self.office = Office()
        self.living = LivingSpace()
        self.office.populate_room_names()