Describe the bug
Currently, there is a structured system in place for test authentication using username and password. However, for endpoints like responses, threads, and now collections, API key–based authentication is required because it carries the necessary organization_id and project_id context.
Since we don’t yet have a centralized or reusable fixture to support API key authentication in tests, we’ve been seeding the database by using a fixture specifically on the test files that need it and inserting API keys within each test file where it’s required. This leads to a lot of repetition and inconsistency across test suites.
Proposed Solution:
-
Introduce a shared fixture (e.g., api_key_auth) that:
-
Seeds the database with a user, organization, project, and API key.
-
Returns consistent headers for use in authenticated requests.
-
Use this fixture across all test modules that require API key–based authentication.
Benefits:
-A consistent, testable flow that reflects actual production behavior for endpoints using org/project-bound API keys.
Describe the bug
Currently, there is a structured system in place for test authentication using username and password. However, for endpoints like responses, threads, and now collections, API key–based authentication is required because it carries the necessary organization_id and project_id context.
Since we don’t yet have a centralized or reusable fixture to support API key authentication in tests, we’ve been seeding the database by using a fixture specifically on the test files that need it and inserting API keys within each test file where it’s required. This leads to a lot of repetition and inconsistency across test suites.
Proposed Solution:
Introduce a shared fixture (e.g., api_key_auth) that:
Seeds the database with a user, organization, project, and API key.
Returns consistent headers for use in authenticated requests.
Use this fixture across all test modules that require API key–based authentication.
Benefits:
DRY (Don’t Repeat Yourself) principle across test files.
Easier onboarding and maintenance for contributors.
-A consistent, testable flow that reflects actual production behavior for endpoints using org/project-bound API keys.