llama-stack-mirror/tests/unit/server
Matt Leader 722d9c53e7
fix(server): add middleware for provider data and test context (#4367)
# What does this PR do?
Consolidates provider data context handling into middleware, eliminating
duplication between FastAPI router routes and legacy @webmethod routes.

Closes #4366 

## Test Plan

Added unit test suite `test_test_context_middleware`, specifically
`test_middleware_extracts_test_id_from_header` to validate the expected
behavior.
```
❯ ./scripts/unit-tests.sh tests/unit/
```

Integration of the middleware test context with the `files` FastAPI
router migration from
[pull/4339](https://github.com/llamastack/llama-stack/pull/4339).
```
❯ git switch migrate-files-api
Switched to branch 'migrate-files-api'
❯ git rebase fix-test-ctx-middleware
Successfully rebased and updated refs/heads/migrate-files-api.
❯ ./scripts/integration-tests.sh --inference-mode replay --suite base --setup ollama --stack-config server:starter --subdirs files
```

Signed-off-by: Matthew F Leader <mleader@redhat.com>
2025-12-16 15:00:48 -05:00
..
test_access_control.py fix: access control to fail-closed when owner attributes are missing (#4273) 2025-12-04 08:38:32 -08:00
test_auth.py test: Update JWKS tests to properly mock authentication (#4257) 2025-12-01 09:57:44 -08:00
test_auth_github.py test: suppress expected error logs in SSE test (#3886) 2025-10-22 14:34:32 -07:00
test_cors.py feat: Add CORS configuration support for server (#3201) 2025-08-21 14:23:27 -07:00
test_quota.py refactor(storage): make { kvstore, sqlstore } as llama stack "internal" APIs (#4181) 2025-11-18 13:15:16 -08:00
test_replace_env_vars.py fix(env): env var replacement preserve types (#3270) 2025-08-28 17:07:18 +02:00
test_resolver.py feat: remove usage of build yaml (#4192) 2025-12-10 10:12:12 +01:00
test_schema_registry.py feat(openapi): switch to fastapi-based generator (#3944) 2025-11-14 15:53:53 -08:00
test_server.py fix: remove_disabled_providers filtering models with None fields (#4132) 2025-11-13 07:24:05 -08:00
test_sse.py fix: rename llama_stack_api dir (#4155) 2025-11-13 15:04:36 -08:00
test_test_context_middleware.py fix(server): add middleware for provider data and test context (#4367) 2025-12-16 15:00:48 -05:00