Fix empty string handling for test password env var
This commit is contained in:
@@ -68,12 +68,13 @@ def get_admin_password() -> str:
|
|||||||
Returns the password from ORCHARD_TEST_PASSWORD environment variable,
|
Returns the password from ORCHARD_TEST_PASSWORD environment variable,
|
||||||
or 'changeme123' as the default for local development.
|
or 'changeme123' as the default for local development.
|
||||||
"""
|
"""
|
||||||
return os.environ.get("ORCHARD_TEST_PASSWORD", "changeme123")
|
# Use 'or' to handle empty string (when CI variable is undefined)
|
||||||
|
return os.environ.get("ORCHARD_TEST_PASSWORD") or "changeme123"
|
||||||
|
|
||||||
|
|
||||||
def get_admin_username() -> str:
|
def get_admin_username() -> str:
|
||||||
"""Get the admin username for test authentication."""
|
"""Get the admin username for test authentication."""
|
||||||
return os.environ.get("ORCHARD_TEST_USERNAME", "admin")
|
return os.environ.get("ORCHARD_TEST_USERNAME") or "admin"
|
||||||
|
|
||||||
|
|
||||||
# Re-export factory functions for backward compatibility
|
# Re-export factory functions for backward compatibility
|
||||||
@@ -248,9 +249,9 @@ def integration_client():
|
|||||||
import httpx
|
import httpx
|
||||||
|
|
||||||
# Connect to the running orchard-server container or deployed environment
|
# Connect to the running orchard-server container or deployed environment
|
||||||
base_url = os.environ.get("ORCHARD_TEST_URL", "http://localhost:8080")
|
base_url = os.environ.get("ORCHARD_TEST_URL") or "http://localhost:8080"
|
||||||
username = os.environ.get("ORCHARD_TEST_USERNAME", "admin")
|
username = get_admin_username()
|
||||||
password = os.environ.get("ORCHARD_TEST_PASSWORD", "changeme123")
|
password = get_admin_password()
|
||||||
|
|
||||||
with httpx.Client(base_url=base_url, timeout=30.0) as client:
|
with httpx.Client(base_url=base_url, timeout=30.0) as client:
|
||||||
# Login as admin to enable write operations
|
# Login as admin to enable write operations
|
||||||
|
|||||||
Reference in New Issue
Block a user