import os
import sys
import unittest
from os import path
from dojo import Dojo
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))


class TestsCasesRoom(unittest.TestCase):
    """Tests all the functionality of create_room method.
    """
    def setUp(self):
        """Creates an instance of the class dojo and passes instance to all tests
         in the test case.
        """
        self.dojo = Dojo()
        self.office1 = self.dojo.create_room('Valhalla', 'office')
        self.room1 = self.dojo.create_room('Nexus', 'livingspace')
        self.office = self.dojo.offices[0].room_type
        self.office_name = self.dojo.offices[0].room_name
        self.offices = self.dojo.offices
        self.rooms = self.dojo.livingrooms
        self.all_rooms = self.dojo.all_rooms

    def test_office_created_successfully(self):
        initial_room_count = len(self.dojo.offices)
        self.office2 = self.dojo.create_room('Hogwarts', 'office')
        new_room_count = len(self.dojo.offices)
        self.assertEqual(new_room_count - initial_room_count, 1)

    def test_living_rooms_created_successfully(self):
        initial_room_count = len(self.rooms)
        self.living = self.dojo.create_room('Python', 'livingspace')
        new_room_count = len(self.rooms)
        self.assertEqual(new_room_count - initial_room_count, 1)

    def test_office_creation_repeated(self):
        initial_room_count = len(self.rooms)
        self.office1 = self.dojo.create_room('Valhalla', 'office')
        new_room_count = len(self.offices)
        self.assertEqual(new_room_count - initial_room_count, 0)

    def test_livingspace_creation_repeated(self):
        initial_room_count = len(self.rooms)
        self.room2 = self.dojo.create_room('Nexus', 'livingspace')
        new_room_count = len(self.rooms)
        self.assertEqual(new_room_count - initial_room_count, 0)


class AddPersonTestCases(unittest.TestCase):
    """Tests all the functionality of create_room method.
    """
    def setUp(self):
        """Create an instance of  the class dojo and pass it all tests in test case
        """
        self.dojo = Dojo()
        self.fellow_no_room = self.dojo.add_person('Salat', 'Abdala', 'Fellow')
        self.fellow_with_room = self.dojo.add_person('Billy', 'Yusuf', 'Fellow', 'Y')
        self.staff = self.dojo.add_person('Naima', 'Hussein', 'Staff')
        self.new_office = self.dojo.create_room('Argon', 'office')
        self.new_room = self.dojo.create_room('west', 'livingspace')

    def test_fellow_no_accommodation_added(self):
        self.assertEqual(self.fellow_no_room,  'SalatAbdala has been added successfully!')

    def test_fellow_with_accomodation_added(self):
        self.assertEqual(self.fellow_with_room, 'BillyYusuf has been added successfully!')

    def test_staff_added(self):
        self.assertEqual(self.staff, 'A Staff NaimaHussein has been added successfully!')





if __name__ == "__main__":
    unittest.main()

@@ -750,53 +750,8 @@
 ooms
-%0A        self.all_rooms = self.dojo.all_rooms
 %0A%0A  
@@ -2114,24 +2114,17 @@
 f.fellow
-_no_room
+1
  = self.
@@ -2172,94 +2172,8 @@
 w')%0A
-        self.fellow_with_room = self.dojo.add_person('Billy', 'Yusuf', 'Fellow', 'Y')%0A
     
@@ -2186,16 +2186,17 @@
 lf.staff
+1
  = self.
@@ -2257,18 +2257,15 @@
 elf.
-new_
 office
+1
  = s
@@ -2317,24 +2317,21 @@
    self.
-new_
 room
+1
  = self.
@@ -2374,291 +2374,716 @@
 e')%0A
-%0A
     
-def test_fellow_no_accommodation_added(self):%0A        self.assertEqual(self.fellow_no_room,  'SalatAbdala has been added successfully!')%0A%0A    def test_fellow_with_accomodation_added(self):%0A        self.assertEqual
+    self.fellow_name = self.dojo.fellows%5B0%5D.fname%0A        self.staff_name = self.dojo.staff%5B0%5D.fname%0A%0A    def test_fellow_added_successfully(self):%0A        initial_fellow_count = len(self.dojo.fellows)%0A        self.fellow2 = self.dojo.add_person('Burei', 'Dollar', 'Fellow')%0A        new_fellow_count = len(self.dojo.fellows)%0A        self.assertEqual(new_fellow_count - initial_fellow_count, 1)%0A%0A    def test_fellow_wants_room_added_successfully(self):%0A        initial_fellow_count = len
 (self.
+dojo.
 fellow
-_with_room, 'BillyYusuf has been added successfully!'
+s)%0A        self.fellow3 = self.dojo.add_person('Jackie', 'Macharia', 'Fellow', 'Y')%0A        new_fellow_count = len(self.dojo.fellows)%0A        self.assertEqual(new_fellow_count - initial_fellow_count, 1
 )%0A%0A 
@@ -3105,16 +3105,29 @@
 ff_added
+_successfully
 (self):%0A
@@ -3138,92 +3138,232 @@
     
-self.assertEqual(self.staff, 'A Staff NaimaHussein has been added successfully!')%0A%0A%0A
+initial_staff_count = len(self.dojo.staff)%0A        self.staff2 = self.dojo.add_person('Eva', 'Njeri', 'Staff')%0A        new_staff_count = len(self.dojo.staff)%0A        self.assertEqual(new_staff_count - initial_staff_count, 1)
 %0A%0A%0Ai

Restructure add_person tests