Example #1
0
class TestManager(unittest.TestCase):
    """Unittest for manager"""

    def setUp(self):
        self.manager = Manager()
        self.allocation = self.manager.allocation()
        self.manager.space_placing()
        self.manager.allocation()
        self.spaces = self.manager.list_spaces()
        self.office = OfficeSpace
        self.room = LivingSpace
        self.tongs = self.office('TONGS', 'OFFICE', 'STAFF')
        self.iroko = self.room('IROKO', 'ROOM', 'FEMALE')

    def test_that_office_spaces_can_be_created(self):
        self.assertIsInstance(self.tongs, self.office)
        self.assertEqual(self.tongs.space_type, 'OFFICE')
        self.assertEqual(self.tongs.occupant_type, 'STAFF')

    def test_that_living_spaces_can_be_created(self):
        self.assertIsInstance(self.iroko, self.room)
        self.assertEqual(self.iroko.space_type, 'ROOM')
        self.assertEqual(self.iroko.occupant_type, 'FEMALE')

    def test_that_spaces_are_available(self):
        self.assertTrue(self.spaces)
Example #2
0
"""
All allocation results.
"""
from models.manager import Manager

manager = Manager()
manager.space_placing()
spaces = manager.list_spaces()
manager.allocation()


class Allocations(object):
    def get_allocated_fellows(self):
        """Return of spaces populated with fellows and staff"""
        print "All allocated fellows and staff are as follows"
        for index in range(len(spaces)-1):
            if spaces[index].space_type == 'OFFICE':
                print spaces[index], "- OFFICE"
                print spaces[index].list_people()

            elif spaces[index].occupant_type == 'MALE':
                print spaces[index], "- MALE ROOM"
                print spaces[index].list_people()

            elif spaces[index].occupant_type == 'FEMALE':
                print spaces[index], "- FEMALE ROOM"
                print spaces[index].list_people()

    def get_unallocated_fellows(self):
        """Return unallocated fellows"""
        print "All unallocated staff are as follows:"