调整lsfx-mock默认数据库配置并更新NAS部署环境
This commit is contained in:
@@ -26,6 +26,8 @@ def _load_ruoyi_mysql_defaults() -> dict:
|
||||
|
||||
|
||||
MYSQL_DEFAULTS = _load_ruoyi_mysql_defaults()
|
||||
LSFX_DEFAULT_CCDI_DB_HOST = "116.62.17.81"
|
||||
LSFX_DEFAULT_CCDI_DB_PORT = 3307
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
@@ -50,8 +52,8 @@ class Settings(BaseSettings):
|
||||
INITIAL_LOG_ID: int = 10000
|
||||
|
||||
# 员工库只读配置
|
||||
CCDI_DB_HOST: str = MYSQL_DEFAULTS.get("host", "")
|
||||
CCDI_DB_PORT: int = int(MYSQL_DEFAULTS.get("port", 3306))
|
||||
CCDI_DB_HOST: str = LSFX_DEFAULT_CCDI_DB_HOST
|
||||
CCDI_DB_PORT: int = LSFX_DEFAULT_CCDI_DB_PORT
|
||||
CCDI_DB_NAME: str = MYSQL_DEFAULTS.get("database", "")
|
||||
CCDI_DB_USERNAME: str = MYSQL_DEFAULTS.get("username", "")
|
||||
CCDI_DB_PASSWORD: str = MYSQL_DEFAULTS.get("password", "")
|
||||
|
||||
@@ -96,6 +96,10 @@ def test_apply_should_insert_new_account_fact_by_account_no():
|
||||
assert len(fake_connection.executed_sql) == 1
|
||||
executed = fake_connection.executed_sql[0]
|
||||
assert "INSERT INTO ccdi_account_info" in executed["sql"]
|
||||
assert "create_by" in executed["sql"]
|
||||
assert "update_by" in executed["sql"]
|
||||
assert "created_by" not in executed["sql"]
|
||||
assert "updated_by" not in executed["sql"]
|
||||
assert executed["params"] == (
|
||||
"6222000000000001",
|
||||
"DEBIT",
|
||||
@@ -140,6 +144,7 @@ def test_apply_should_update_existing_account_fact_by_account_no():
|
||||
assert len(fake_connection.executed_sql) == 1
|
||||
executed = fake_connection.executed_sql[0]
|
||||
assert "ON DUPLICATE KEY UPDATE" in executed["sql"]
|
||||
assert "update_by = VALUES(update_by)" in executed["sql"]
|
||||
assert executed["params"][0] == "6222000000000001"
|
||||
assert executed["params"][2] == "测试员工结算卡"
|
||||
assert executed["params"][10] == 1
|
||||
|
||||
@@ -15,11 +15,14 @@ def test_ruoyi_mysql_defaults_should_follow_application_dev_config():
|
||||
assert _load_ruoyi_mysql_defaults()["port"] == match.group("port")
|
||||
|
||||
|
||||
def test_settings_should_use_ruoyi_mysql_defaults():
|
||||
def test_settings_should_default_to_lsfx_target_mysql_host_and_port():
|
||||
assert settings.CCDI_DB_HOST == "116.62.17.81"
|
||||
assert settings.CCDI_DB_PORT == 3307
|
||||
|
||||
|
||||
def test_settings_should_still_use_ruoyi_mysql_defaults_for_db_name_and_credentials():
|
||||
defaults = _load_ruoyi_mysql_defaults()
|
||||
|
||||
assert settings.CCDI_DB_HOST == defaults["host"]
|
||||
assert settings.CCDI_DB_PORT == int(defaults["port"])
|
||||
assert settings.CCDI_DB_NAME == defaults["database"]
|
||||
assert settings.CCDI_DB_USERNAME == defaults["username"]
|
||||
assert settings.CCDI_DB_PASSWORD == defaults["password"]
|
||||
|
||||
Reference in New Issue
Block a user