def test_guest_parse():
  reservation = models.Reservation()
  for _ in range(1000):
    f = FakeAirbnbReservation(ReservationType.PAST)
    valid = AirbnbConnection._process_guest(f.raw_reservation, f.key_value_pair(), reservation)
    assert reservation.guest == f._guest
    assert valid
Example #2
0
def reserve_table(db: Session, table_id: int, customer_id: str, reservation: schemas.ReservationCreate, order_id: int) -> schemas.Reservation:
    db_item = models.Reservation(customer_id=customer_id, table_id=table_id,
                                 start_time=reservation.start_time, end_time=reservation.end_time, order_id=order_id)
    db.add(db_item)
    db.commit()
    db.refresh(db_item)
    return db_item
Example #3
0
def test_guest_blocked():
    reservation = models.Reservation()
    for _ in range(100):
        f = FakeVrboReservation(ReservationType.PAST, blocked=True)
        valid = VrboConnection._process_guest(f.raw_reservation,
                                              f.key_value_pair(), reservation)
        assert not valid
Example #4
0
  def _process_raw_reservation(self, raw_reservation):
    reservation = models.Reservation()
    key_value_reservation = self._recover_reservation_key_values(raw_reservation)
    # Pull name
    if not self._process_guest(raw_reservation, key_value_reservation, reservation): return False
    # Pull start
    if not self._process_start(raw_reservation, key_value_reservation, reservation): return False
    # Pull end
    if not self._process_end(raw_reservation, key_value_reservation, reservation): return False

    self._process_duration(reservation)
    # ... Implement any special extraction in service class by defining function and calling super() to ensure base process is executed
    return reservation