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>
- 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>