class ReservationTestCase(unittest.TestCase):
    def setUp(self):
        self.hotel = Hotel(1, 'Rotana', 'Abu Dhabi', 3)
        self.hotel.add_to_list()

    def tearDown(self):
        self.hotel.remove_from_list()

    def test_01_reserve_room_from_24_to_28(self):
        check_in_date = '5/24/18'
        check_out_date = '5/28/18'
        customer = Customer('Ali', '+12345678901')
        reservation = Reservation(self.hotel, customer, check_in_date,
                                  check_out_date)
        self.assertTrue(reservation.reserve(),
                        msg='a room should have been reserved from %s to %s'\
                        %(check_in_date, check_out_date))

    def test_02_reserve_room_from_24_to_26(self):
        check_in_date = '5/24/18'
        check_out_date = '5/26/18'
        customer = Customer('Ahmed', '+12345678901')
        reservation = Reservation(self.hotel, customer, check_in_date,
                                  check_out_date)
        self.assertTrue(reservation.reserve(),
                        msg='a room should have been reserved from %s to %s'\
                        %(check_in_date, check_out_date))

    def test_03_reserve_room_from_25_to_27(self):
        check_in_date = '5/25/18'
        check_out_date = '5/27/18'
        customer = Customer('Heba', '+12345678901')
        reservation = Reservation(self.hotel, customer, check_in_date,
                                  check_out_date)
        self.assertTrue(reservation.reserve(),
                        msg='a room should have been reserved from %s to %s'\
                        %(check_in_date, check_out_date))

    def test_04_reserve_room_from_24_to_25(self):
        check_in_date = '5/24/18'
        check_out_date = '5/25/18'
        customer = Customer('Ali', '+16132614041')
        reservation = Reservation(self.hotel, customer, check_in_date,
                                  check_out_date)
        self.assertTrue(reservation.reserve(),
                        msg='a room should have been reserved from %s to %s'\
                        %(check_in_date, check_out_date))

    def test_05_reserve_room_from_25_to_27(self):
        check_in_date = '5/25/18'
        check_out_date = '5/27/18'
        customer = Customer('Ali', '+16132614041')
        reservation = Reservation(self.hotel, customer, check_in_date,
                                  check_out_date)
        # Hotel is full from 25 to 27
        self.assertFalse(reservation.reserve(),
                        msg='no room should have been reserved from %s to %s'\
                        %(check_in_date, check_out_date))
class HotelTestCase(unittest.TestCase):
    def setUp(self):
        self.hotel1 = Hotel(20, 'Rotana', 'Abu Dhabi', 200)
        self.hotel2 = Hotel(21, 'Sheraton', 'Abu Dhabi', 300)

    def tearDown(self):
        self.hotel1.remove_from_list()
        self.hotel2.remove_from_list()

    def test_01_add_hotel_to_list(self):
        self.hotel1.add_to_list()
        #Verify that hotel1 exists in list
        self.assertTrue(self.hotel1.is_added_to_list(),
                        msg='new hotel1 should have been in hotels list')
        self.hotel2.add_to_list()
        #Verify that hotel2 and hotel2 exists in list
        self.assertTrue(self.hotel2.is_added_to_list(),
                        msg='new hotel2 should have been in hotels list')

    def test_02_get_hotels_in_city(self):
        #Verify that no hotels in Abu Dhabi initially exist
        hotels = Hotel.get_hotels_in_city('Abu Dhabi')
        self.assertTrue(
            len(hotels) == 0,
            msg='No hotels in Abu Dhabi should have been initially existing')
        #Add 2 hotels to list
        self.hotel1.add_to_list()
        self.hotel2.add_to_list()
        #Verify that 2 hotels are in Abu Dhabi
        hotels = Hotel.get_hotels_in_city('Abu Dhabi')
        self.assertTrue(len(hotels) == 2 and\
                        hotels[0] == self.hotel1 and\
                        hotels[1] == self.hotel2,
                        msg='2 hotels in Abu Dhabi should have been existing')