示例#1
0
    def test_it_returns_an_empty_list_if_everything_has_been_reimbursed(self):
        # Given
        booking_paid1 = Booking()
        booking_paid1.payments = [Payment()]
        booking_reimbursement1 = BookingReimbursement(
            booking_paid1, ReimbursementRules.PHYSICAL_OFFERS, Decimal(10))

        booking_paid2 = Booking()
        booking_paid2.payments = [Payment()]
        booking_reimbursement2 = BookingReimbursement(
            booking_paid2, ReimbursementRules.PHYSICAL_OFFERS, Decimal(10))

        # When
        bookings_not_paid = filter_out_already_paid_for_bookings(
            [booking_reimbursement1, booking_reimbursement2])

        # Then
        assert bookings_not_paid == []
示例#2
0
    def test_it_returns_reimbursements_on_bookings_with_no_existing_payments(
            self):
        # Given
        booking_paid = Booking()
        booking_paid.payments = [Payment()]
        booking_reimbursement1 = BookingReimbursement(
            booking_paid, ReimbursementRules.PHYSICAL_OFFERS, Decimal(10))
        booking_not_paid = Booking()
        booking_reimbursement2 = BookingReimbursement(
            booking_not_paid, ReimbursementRules.PHYSICAL_OFFERS, Decimal(10))
        booking_reimbursements = [
            booking_reimbursement1, booking_reimbursement2
        ]

        # When
        bookings_not_paid = filter_out_already_paid_for_bookings(
            booking_reimbursements)

        # Then
        assert len(bookings_not_paid) == 1
        assert not bookings_not_paid[0].booking.payments