Skip to content

fix: use configured discount code in totals test - #80

Merged
damaz91 merged 2 commits into
Universal-Commerce-Protocol:mainfrom
FanouZeng-TT:fix/configured-discount-code-in-totals-test
Aug 11, 2026
Merged

fix: use configured discount code in totals test#80
damaz91 merged 2 commits into
Universal-Commerce-Protocol:mainfrom
FanouZeng-TT:fix/configured-discount-code-in-totals-test

Conversation

@FanouZeng-TT

Copy link
Copy Markdown
Contributor

Description

totals_test.py defined a module-level _DISCOUNT_CODE and used it when driving the discounted checkout helper:

# A percentage discount code recognized by the reference data set. If the
# server under test does not recognize it, the discount-sign test skips.
_DISCOUNT_CODE = "10OFF"
...
updated = self.update_checkout_session(
  checkout_obj, discounts={"codes": [_DISCOUNT_CODE]}
)

The rest of the conformance suite reads the test discount code through
fixture_ctx.get_test_discount_code(), which comes from valid_discount_code in
the configured fixture data with the existing fallback chain. The hardcoded
"10OFF" only matches the default fixture. A server tested with a non-default
fixture, for example "PROMO20", would receive an unrecognized discount code,
return no discount totals entry, and make test_discount_entry_is_negative
skip instead of checking the negative-sign invariant.

Fix: use self.fixture_ctx.get_test_discount_code() in
_discounted_checkout_totals() so the totals sign test applies the same discount
code as the active fixture.

Category (Required)

  • Core Protocol: Changes to core UCP JSON schemas, protocol behavior, or specification semantics. (Requires Technical Council approval)
  • Governance/Contributing: Changes to contribution process, governance, or project policy. (Requires Governance Council approval)
  • Capability: Additions or changes to optional protocol capabilities. (Requires Maintainer approval)
  • Documentation: Documentation-only changes. (Requires Maintainer approval)
  • Infrastructure: CI, build, release, or repository infrastructure changes. (Requires DevOps Maintainer approval)
  • Maintenance: Dependency updates, cleanup, or non-functional maintenance. (Requires DevOps Maintainer approval)
  • SDK: Language-specific SDK updates and releases. (Requires DevOps Maintainer approval)
  • Samples / Conformance: Maintaining samples and the conformance suite. (Requires Maintainer approval)
  • UCP Schema: Changes to the ucp-schema tool. (Requires Maintainer approval)
  • Community Health (.github): Organization health files, templates, or community metadata. (Requires DevOps Maintainer approval)

Related Issues

N/A

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected, including removal of schema files or fields)
  • Documentation update

Is this a Breaking Change or Removal?

N/A — test-only fix, no schema/field removal.

Checklist

  • I have followed the Contributing Guide for this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation (if applicable).
  • My changes generate no new warnings.
  • My changes pass all local linting and formatting checks.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • (For Core/Capability) I have included/updated the relevant JSON schemas.
  • Any dependent changes have been merged and published in downstream modules.
  • I have regenerated Python Pydantic models by running generate_models.sh under python_sdk.

Screenshots / Logs (if applicable)

N/A — test-only conformance fix.

@damaz91
damaz91 merged commit 38ae0c6 into Universal-Commerce-Protocol:main Aug 11, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants