Commit 5b26e16
committed
refactor(tests): centralize integration test fixtures and eliminate duplication
Refactors integration tests to eliminate code duplication by centralizing common fixtures,
test constants, and mock builder utilities in `tests/integration/conftest.py`.
Also adds comprehensive documentation for writing integration tests, so that all coding agents
have a central source of truth of best practices.
**Motivation**
- **Code duplication**: Test files had duplicate fixture definitions (~143 lines across files)
- **Manual mock creation**: Tests manually created mock objects with repetitive boilerplate
- **Magic strings**: Hard-coded UUIDs and test values scattered across test files
- **Missing documentation**: No central guide for writing integration tests
**Benefits**
- **D.R.Y principle**: Mock creation logic in one place
- **Maintainability**: Changes to mock structure only need updates in conftest.py
- **Consistency**: All tests use same constants and patterns
- **(AI)Developer experience**: Clear documentation for writing new tests
- **Less boilerplate**: New tests require less setup code
Signed-off-by: Anik Bhattacharjee <anbhatta@redhat.com>1 parent 861a8dc commit 5b26e16
5 files changed
Lines changed: 758 additions & 229 deletions
File tree
- tests/integration
- endpoints
0 commit comments