fix: use configured fixed-discount amount in business_logic_test - #71
Merged
damaz91 merged 1 commit intoJul 31, 2026
Conversation
test_fixed_amount_discount fetched the expected reduction into expected_discount and already passed it to assert_totals_consistent, but the separate assertion on discounts.applied[0].amount hardcoded 500 instead of using that variable. Any non-default fixture (e.g. a 7.50 fixed reduction) would fail the second assertion even though the totals check passed. get_expected_fixed_discount_reduction() already returns minor units, so the hardcoded 500 only matched the default flower_shop fixture by coincidence.
Contributor
|
Nice catch, thanks @XiaolongZhang-TT ! |
damaz91
approved these changes
Jul 31, 2026
nicholasjameshall
approved these changes
Jul 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
test_fixed_amount_discountinbusiness_logic_test.pyfetched the expected reduction intoexpected_discountand already passed it toassert_totals_consistent(...), but the separate assertion ondiscounts.applied[0].amounthardcoded500instead of using that variable:get_expected_fixed_discount_reduction()already returns the value in minor units (expected_fixed_discount_reductionmajor units × 100), so the hardcoded500only matched the default flower_shop fixture (5.00 → 500) by coincidence. Any non-default fixture (e.g. a configured7.50fixed reduction → expected750) would pass the totals-consistency check but fail theapplied[0].amountassertion for the same checkout, an internal contradiction.Fix: assert against
expected_discount, making the two assertions in the same test consistent and server-agnostic.Type of change
Is this a Breaking Change or Removal?
N/A — test-only fix, no schema/field removal.
Checklist