def test_modificar_cotxe_import_total(self): p = Viatgers(4) past = p.get_num_viatgers() c1 = Car("COTXE1", "CITROEN", "LLOC1", past, 25.0) c2 = Car("COTXE2", "SEAT", "LLOC2", past, 19.0) cotxes = [c1] c = Cars(past, cotxes) c.modificar_cotxe(c1, c2) self.assertEqual(c.calcul_import_total_cotxe(), 76.0)
def test_modificar_vol_calcular_import(self): p = Viatgers(3) past = p.get_num_viatgers() f1 = Vol("CODIGO1", "MILAN", past, 25.0) f2 = Vol("CODIGO2", "BARCELONA", past, 19.0) vols = [f1] v = Flights(past, vols) v.modifica_desti(f1, f2) self.assertEqual(v.calcul_import_total_vols(), 57.0)
def test_afegir_cotxe_import_total(self): p = Viatgers(4) past = p.get_num_viatgers() c1 = Car("COTXE1", "CITROEN", "LLOC1", past, 25.0) c2 = Car("COTXE2", "SEAT", "LLOC2", past, 19.0) c3 = Car("COTXE3", "MERCEDES-BENZ", "LLOC3", past, 32.0) cotxes = [c1, c2] c = Cars(past, cotxes) c.afegir_cotxe(c3) self.assertEqual(c.calcul_import_total_cotxe(), 304.0)
def test_modificar_vol_llista_hotels(self): p = Viatgers(3) past = p.get_num_viatgers() f1 = Vol("CODIGO1", "MILAN", past, 25.0) f2 = Vol("CODIGO2", "BARCELONA", past, 19.0) vols = [f1] v = Flights(past, vols) v.modifica_desti(f1, f2) test_llista_vols = [f2] self.assertEqual(v.get_llista_vols(), test_llista_vols)
def test_afegir_vol_calcular_import(self): p = Viatgers(3) past = p.get_num_viatgers() f1 = Vol("CODIGO1", "MILAN", past, 25.0) f2 = Vol("CODIGO2", "BARCELONA", past, 19.0) f3 = Vol("CODIGO3", "PARIS", past, 32.0) vols = [f1, f2] v = Flights(past, vols) v.afegeix_desti(f3) self.assertEqual(v.calcul_import_total_vols(), 228.0)
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_afegir_vol_llista_vols(self): p = Viatgers(3) past = p.get_num_viatgers() f1 = Vol("CODIGO1", "MILAN", past, 25.0) f2 = Vol("CODIGO2", "BARCELONA", past, 19.0) f3 = Vol("CODIGO3", "PARIS", past, 32.0) vols = [f1, f2] v = Flights(past, vols) v.afegeix_desti(f3) test_llista_vols = [f1, f2, f3] self.assertEqual(v.get_llista_vols(), test_llista_vols)
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 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 test_get_num_viatgers(self): v = Viatgers(5) self.assertEqual(v.get_num_viatgers(), 5)