Make auth tests use configurable admin password

- Add get_admin_password() and get_admin_username() helpers to conftest.py
- Update test_auth_api.py to use helpers instead of hardcoded credentials
- Allows tests to work with different passwords in feature/stage/prod envs

The ORCHARD_TEST_PASSWORD environment variable is set by CI jobs to match
the deployed environment's admin password.
This commit is contained in:
Mondo Diaz
2026-01-27 19:15:18 +00:00
parent 0dd1eb6d59
commit aeb805e975
2 changed files with 49 additions and 27 deletions

View File

@@ -56,6 +56,26 @@ os.environ.setdefault("ORCHARD_S3_BUCKET", "test-bucket")
os.environ.setdefault("ORCHARD_S3_ACCESS_KEY_ID", "test")
os.environ.setdefault("ORCHARD_S3_SECRET_ACCESS_KEY", "test")
# =============================================================================
# Admin Credentials Helper
# =============================================================================
def get_admin_password() -> str:
"""Get the admin password for test authentication.
Returns the password from ORCHARD_TEST_PASSWORD environment variable,
or 'changeme123' as the default for local development.
"""
return os.environ.get("ORCHARD_TEST_PASSWORD", "changeme123")
def get_admin_username() -> str:
"""Get the admin username for test authentication."""
return os.environ.get("ORCHARD_TEST_USERNAME", "admin")
# Re-export factory functions for backward compatibility
from tests.factories import (
create_test_file,