def should_cancel_every_bookings_for_target_stock(self, app):
        # Given
        booking = bookings_factories.BookingFactory()

        # When
        soft_delete_stock(booking.stock.id)

        # Then
        assert booking.isCancelled
    def should_return_ko_if_at_least_one_booking_is_used(self, app):
        # Given
        booking = bookings_factories.BookingFactory(isUsed=True)

        # When
        soft_delete_stock(booking.stock.id)

        # Then
        assert not booking.stock.isSoftDeleted
예제 #3
0
    def should_return_ok_if_stock_has_no_bookings_and_soft_delete_it(self):
        # Given
        stock = offer_factories.StockFactory()

        # When
        soft_delete_stock(stock.id)

        # Then
        assert stock.isSoftDeleted
예제 #4
0
    def should_return_ko_if_at_least_one_booking_has_payments(self):
        # Given
        booking = payment_factories.PaymentFactory().booking

        # When
        soft_delete_stock(booking.stock.id)

        # Then
        assert not booking.stock.isSoftDeleted
    def should_return_ko_if_at_least_one_booking_has_payments(self, app):
        # Given
        booking = bookings_factories.BookingFactory(isUsed=True)
        payment = payment_factories.PaymentFactory(booking=booking)

        # When
        soft_delete_stock(payment.booking.stock.id)

        # Then
        assert not booking.stock.isSoftDeleted
예제 #6
0
    def should_cancel_every_bookings_for_target_stock(self):
        # Given
        booking = bookings_factories.IndividualBookingFactory()

        # When
        soft_delete_stock(booking.stock.id)

        # Then
        assert booking.isCancelled
        assert booking.status is BookingStatus.CANCELLED