19 lines
826 B
Python
19 lines
826 B
Python
import os
|
|
import tempfile
|
|
from pathlib import Path
|
|
|
|
|
|
# Never let the integration tests inherit a development or production MySQL
|
|
# URL. The application is imported during test collection, so the isolated
|
|
# database must be selected before any test module imports app.main.
|
|
_test_dir = Path(tempfile.mkdtemp(prefix="wendajia-tests-"))
|
|
os.environ["DATABASE_URL"] = f"sqlite:///{(_test_dir / 'app.db').as_posix()}"
|
|
os.environ["SCREENSHOT_STORAGE_DIR"] = str(_test_dir / "screenshots")
|
|
os.environ["ADMIN_USERNAME"] = "admin"
|
|
os.environ["ADMIN_PASSWORD"] = "admin123456"
|
|
os.environ["OPERATOR_USERNAME"] = "operator"
|
|
os.environ["OPERATOR_PASSWORD"] = "operator123456"
|
|
# Integration tests must never call the real payout API or inherit the
|
|
# developer machine's real payer-account restriction.
|
|
os.environ["ALIPAY_ENABLED"] = "false"
|