Exemplo n.º 1
0
def test_car_add_reservation_twice():
    car = Car("Sportback", "BMW", "X1", "5", "Diesel, 7", "AWD")
    reservation = Reservation("02.01.2021", "09.01.2021", "Thomas")
    car.add_reservation(reservation)
    assert car.reservation == reservation
    assert car.last_reserved() == f'{datetime.now():%d.%m.%Y}'
    assert car.add_reservation(reservation) == "Cannot reserve today"
Exemplo n.º 2
0
def test_not_reserved_cars():
    car = Car("Sportback", "BMW", "X1", "5", "Diesel, 7", "AWD")
    reservation = Reservation("02.01.2021", "27.02.2021", "Thomas")
    car.add_reservation(reservation)
    car2 = Van("Van", "Volvo", "Splinter", "2", "Diesel, 14", "FWD", "1500L")
    cars = [car, car2]
    not_reserved = not_reserved_cars(cars)
    assert not_reserved == [car2]
Exemplo n.º 3
0
def test_car_add_reservation_expired():
    car = Car("Sportback", "BMW", "X1", "5", "Diesel, 7", "AWD")
    reservation = Reservation("02.01.2021", "06.01.2021", "Thomas")
    car.add_reservation(reservation)
    assert car.reservation.check_expiration() == "EXPIRED"