def test_find_overlapping_with_is_not_valid(overlapping_reservation, dummy_user): reservation, occurrence = overlapping_reservation assert reservation in Reservation.find_overlapping_with(room=reservation.room, occurrences=[occurrence]).all() reservation.cancel(dummy_user, silent=True) assert reservation not in Reservation.find_overlapping_with(room=reservation.room, occurrences=[occurrence]).all()
def test_find_overlapping_with_different_room(overlapping_reservation, create_room): reservation, occurrence = overlapping_reservation assert reservation in Reservation.find_overlapping_with( room=reservation.room, occurrences=[occurrence]).all() assert reservation not in Reservation.find_overlapping_with( room=create_room(), occurrences=[occurrence]).all()
def test_find_overlapping_with_is_not_valid(overlapping_reservation, dummy_user): reservation, occurrence = overlapping_reservation assert reservation in Reservation.find_overlapping_with(room=reservation.room, occurrences=[occurrence]).all() reservation.cancel(dummy_user, silent=True) assert reservation not in Reservation.find_overlapping_with(room=reservation.room, occurrences=[occurrence]).all()
def test_find_overlapping_with_skip_reservation(overlapping_reservation): reservation, occurrence = overlapping_reservation assert reservation in Reservation.find_overlapping_with( room=reservation.room, occurrences=[occurrence]).all() assert reservation not in Reservation.find_overlapping_with( room=reservation.room, occurrences=[occurrence], skip_reservation_id=reservation.id).all()
def test_find_overlapping_with_is_not_valid(overlapping_reservation, dummy_user, freeze_time): freeze_time(datetime.combine(date.today(), time(1))) reservation, occurrence = overlapping_reservation assert reservation in Reservation.find_overlapping_with(room=reservation.room, occurrences=[occurrence]).all() reservation.cancel(dummy_user, silent=True) assert reservation not in Reservation.find_overlapping_with(room=reservation.room, occurrences=[occurrence]).all()
def test_find_overlapping_with_skip_reservation(overlapping_reservation): reservation, occurrence = overlapping_reservation assert reservation in Reservation.find_overlapping_with(room=reservation.room, occurrences=[occurrence]).all() assert ( reservation not in Reservation.find_overlapping_with( room=reservation.room, occurrences=[occurrence], skip_reservation_id=reservation.id ).all() )
def _checkSplitRooms(self, room, occs): if room in self.splitmap: for ri in self.splitmap[room]: oroom = Room.get_or_404(ri, is_deleted=False) overlap = Reservation.find_overlapping_with(oroom, occs).all() if overlap: raise ExpectedError( 'Overlaps with other reservations in {}.'.format( oroom.name)) else: for ri, splits in self.splitmap.items(): if room in splits: oroom = Room.get_or_404(ri, is_deleted=False) overlap = Reservation.find_overlapping_with(oroom, occs).all() if overlap: raise ExpectedError( 'Overlaps with other reservations in {}.'.format( oroom.name)) break
def test_find_overlapping_with_different_room(overlapping_reservation, create_room): reservation, occurrence = overlapping_reservation assert reservation in Reservation.find_overlapping_with(room=reservation.room, occurrences=[occurrence]).all() assert reservation not in Reservation.find_overlapping_with(room=create_room(), occurrences=[occurrence]).all()