30 lines
1.3 KiB
Python
30 lines
1.3 KiB
Python
"""
|
|
backend/tests/voucher_check/test_erp_settings.py
|
|
|
|
用途:立账凭证 ERP 凭据回退到通用 ERP_* / 合同付款同一套只读账号。
|
|
依赖:voucher_check.config._erp_settings、Flask app。
|
|
逻辑:清空 VOUCHER_CHECK_ERP_USERNAME 后仍能从 CONTRACT_PAYMENT_ERP_* 读到账号。
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from app.services.voucher_check.config import _erp_settings
|
|
|
|
|
|
def test_erp_settings_falls_back_to_contract_payment_credentials(app):
|
|
"""未单独配 VOUCHER_CHECK_ERP_USERNAME 时,应复用合同付款已有的只读账号。"""
|
|
with app.app_context():
|
|
app.config["VOUCHER_CHECK_ERP_DSN"] = ""
|
|
app.config["VOUCHER_CHECK_ERP_USERNAME"] = ""
|
|
app.config["VOUCHER_CHECK_ERP_PASSWORD"] = ""
|
|
app.config["ERP_DB_DSN"] = "192.168.8.24:1521/topprod"
|
|
app.config["ERP_USERNAME"] = ""
|
|
app.config["ERP_PASSWORD"] = ""
|
|
app.config["CONTRACT_PAYMENT_ERP_USERNAME"] = "hxjm_ro"
|
|
app.config["CONTRACT_PAYMENT_ERP_PASSWORD"] = "secret-from-contract-payment"
|
|
dsn, username, password, timeout = _erp_settings()
|
|
assert dsn == "192.168.8.24:1521/topprod"
|
|
assert username == "hxjm_ro"
|
|
assert password == "secret-from-contract-payment"
|
|
assert timeout >= 1
|