Commit Graph

2 Commits

Author SHA1 Message Date
b65c51c038 test: realign deps + page_context tests with current source
All checks were successful
CI / ruff (push) Successful in 18s
CI / pytest (push) Successful in 2h27m38s
CI / dependency-scanning (push) Successful in 32s
CI / docs (push) Successful in 50s
CI / validate (push) Successful in 31s
CI / deploy (push) Successful in 3m44s
Two stale unit-test groups left over from earlier intentional changes:

1. tests/unit/api/test_deps.py — TestGetCurrentStoreApi
   get_current_store_api gained a leading `request: Request` param in
   commit 6276e9e3 (terminal-device pairing) so the device-token path
   could record last_seen IP. The three tests still passed `(creds, db)`
   positionally, so `creds` bound to `request` and the function blew up
   with `Session has no attribute 'credentials'`. Pass a mock request
   first using the existing `_make_request` helper.

2. tests/unit/utils/test_page_context.py — TestBaseUrlCalculation
   d591200d switched the storefront base_url builder to use
   `store.subdomain or store.store_code` (lowercase slug) because the
   store-context middleware resolves URLs by the lowercase slug; the
   uppercase `store_code` is for internal use. Tests still asserted the
   old uppercase shape. Update the two URL assertions to the lowercase
   subdomain, invert `test_base_url_uses_store_code_not_subdomain` into
   `test_base_url_uses_subdomain_not_store_code`, and add a fallback
   test that exercises the `or store.store_code` path when subdomain
   is None.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 22:58:07 +02:00
f47c680cb8 fix: storefront login 403, cookie path, double-storefront URLs, and auth redirects
Some checks failed
CI / ruff (push) Successful in 9s
CI / pytest (push) Failing after 46m52s
CI / validate (push) Successful in 23s
CI / dependency-scanning (push) Successful in 30s
CI / docs (push) Has been skipped
CI / deploy (push) Has been skipped
- Extract store/platform context from Referer header for storefront API requests
  (StoreContextMiddleware and PlatformContextMiddleware) so login POST works in
  dev mode where API paths lack /platforms/{code}/ prefix
- Set customer token cookie path to "/" for cross-route compatibility
- Fix double storefront in URLs: replace {{ base_url }}storefront/ with {{ base_url }}
  across all 24 storefront templates
- Fix auth error redirect to include platform prefix and use store_code
- Update seed script to output correct storefront login URLs
- Add 20 new unit tests covering all fixes; fix 9 pre-existing test failures

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 12:29:52 +01:00