def test_modificar_hotel_calcular_preu(self): p = Viatgers(4) past = p.get_num_viatgers() h1 = Hotel("SVC_1", "ATENEA", past, 5, 23) h2 = Hotel("SVC_2", "IBIS", past, 7, 34) hotels = [h1] H = Hotels(hotels) H.modifica_hotel(h1, h2) test_preu = 952.0 self.assertEqual(H.calcul_import_total_hotels(), test_preu)
def test_eliminar_hotel_calcular_preu(self): p = Viatgers(4) past = p.get_num_viatgers() h1 = Hotel("SVC_1", "ATENEA", past, 5, 23) h2 = Hotel("SVC_2", "IBIS", past, 7, 34) h3 = Hotel("SVC_3", "KINGH", past, 4, 15) hotels = [h1, h2, h3] H = Hotels(hotels) H.elimina_hotel("KINGH") test_preu = 1412.0 self.assertEqual(H.calcul_import_total_hotels(), test_preu)
def default_hotel_list(): """ Fixture to create a list of Hotel objects from default values. """ h0 = Hotel(DEFAULT_HOTEL_CODE_0, DEFAULT_HOTEL_NAME_0, DEFAULT_HOTEL_DAYS_RESERVED) h1 = Hotel(DEFAULT_HOTEL_CODE_1, DEFAULT_HOTEL_NAME_1, DEFAULT_HOTEL_DAYS_RESERVED) h2 = Hotel(DEFAULT_HOTEL_CODE_2, DEFAULT_HOTEL_NAME_2, DEFAULT_HOTEL_DAYS_RESERVED) return [h0, h1, h2]
def test_viaje_eliminar_alojamiento(self): hotel = Hotel(4321, 'Port Aventura Hotel', 5, 2, 4, 100) hotel2 = Hotel(4321, 'Port Aventura Hotel', 5, 2, 4, 200) self.hotels.añadir_hotel(hotel) self.hotels.añadir_hotel(hotel2) self.hotels.eliminar_hotel(hotel) self.hotels.eliminar_hotel(hotel2) self.assertEqual(50, self.hotels.getpreciototal())
def test_comprovacio_tipus_tarjeta_incorrecte(self): p = Viatgers(4) past = p.get_num_viatgers() f = Vol("1234ABC", "MILAN", past, 10.0) f2 = Vol("5467DEF", "PARIS", past, 20.0) Vtg = [f, f2] v = Flights(past, Vtg) c1 = Car("COTXE1", "FERRARI", "MILAN", past, 30.0) cot = [c1] c = Cars(past, cot) h1 = Hotel("HOTEL1", "MILANO", past, 4, 20.0) h2 = Hotel("HOTEL2", "LE PARIS", past, 6, 25.0) hot = [h1, h2] h = Hotels(hot) p2 = PaymentData("PAYPAL", "Samu", "123456789", "ABC", v, c, h) self.assertEqual(p2.comprobar_targeta(), False)
def test_calcula_preu(self): p = Viatgers(4) past = p.get_num_viatgers() f = Vol("1234ABC", "MILAN", past, 10.0) f2 = Vol("5467DEF", "PARIS", past, 20.0) Vtg = [f, f2] v = Flights(past, Vtg) c1 = Car("COTXE1", "FERRARI", "MILAN", 4, 30.0) cot = [c1] c = Cars(past, cot) h1 = Hotel("HOTEL1", "MILANO", past, 4, 20.0) h2 = Hotel("HOTEL2", "LE PARIS", past, 6, 25.0) hot = [h1, h2] h = Hotels(hot) p = PaymentData("Visa", "Ruben", "1234", "1342", v, c, h) self.assertEqual(p.get_import_total(), 1160.0)
def añadir_hotel(self, Hotel): self.listahoteles.append(Hotel) self.precio_total = self.precio_total + Hotel.getprecio()
def setUp(self) -> None: self.hotel = Hotel(1234, 'Royal Palace', 5, 2, 7, 50) self.hotels = Hotels() self.hotels.añadir_hotel(self.hotel)