Exemple #1
0
def test_overdue_cars():
    car = Car("Sportback", "BMW", "X1", "5", "Diesel, 7", "AWD")
    rent = Rent("01.01.2021", "02.01.2021", "Thomas")
    car.rent = rent
    cars = [car]
    overdue = overdue_cars(cars)
    assert overdue == [car]
Exemple #2
0
def test_search_availability():
    car = Car("Sportback", "BMW", "X1", "5", "Diesel, 7", "AWD")
    today = datetime.today()
    tommorow = today + timedelta(days=2)
    today = f'{datetime.now():%d.%m.%Y}'
    tommorow = f'{tommorow:%d.%m.%Y}'
    rent = Rent("9.01.2021", today, "Thomas")
    crit = {
        "Rent":
        {
            "Return date": tommorow
        }
    }
    car.rent = rent
    search = search_database(crit, [car])
    assert car in search
Exemple #3
0
def test_search_multiple():
    car = Car("Sportback", "BMW", "X1", "5", "Diesel, 7", "AWD")
    car2 = Van("Van", "Volvo", "Splinter", "2", "Diesel, 14", "FWD", "1500L")
    today = datetime.today()
    tommorow = today + timedelta(days=2)
    today = f'{datetime.now():%d.%m.%Y}'
    tommorow = f'{tommorow:%d.%m.%Y}'
    reservation = Reservation("9.01.2021", today, "Thomas")
    rent = Rent("9.01.2021", today, "Thomas")
    crit = {
        "Rent":
        {
            "Return date": tommorow
        }
    }
    car.rent = rent
    car2.add_reservation(reservation)
    search = search_database(crit, [car, car2])
    assert search == [car, car2]