fix: dry-run mock KIS validation in workflows

This commit is contained in:
2026-06-21 23:22:22 +09:00
parent 610b9b1330
commit 3002149fce
8 changed files with 86 additions and 14 deletions
@@ -25,8 +25,8 @@ def test_validate_kis_api_credentials_writes_pass_json(tmp_path, monkeypatch):
monkeypatch.setenv("KIS_APP_Key_TEST", "mock-key")
monkeypatch.setenv("KIS_APP_Secret_TEST", "mock-secret")
monkeypatch.setattr(validator, "KisCredentials", type("CredFactory", (), {"load": staticmethod(lambda account: _FakeCreds(account))}))
monkeypatch.setattr(validator, "get_current_price", lambda creds, ticker: {"ticker": ticker, "price": 1000})
monkeypatch.setattr(sys, "argv", ["validate_kis_api_credentials_v1.py", "--account", "mock", "--ticker", "005930", "--output", str(out)])
monkeypatch.setattr(validator, "get_current_price", lambda creds, ticker: (_ for _ in ()).throw(RuntimeError("network should not be called in dry-run")))
monkeypatch.setattr(sys, "argv", ["validate_kis_api_credentials_v1.py", "--account", "mock", "--ticker", "005930", "--dry-run", "--output", str(out)])
rc = validator.main()
payload = json.loads(out.read_text(encoding="utf-8"))
@@ -35,6 +35,7 @@ def test_validate_kis_api_credentials_writes_pass_json(tmp_path, monkeypatch):
assert payload["gate"] == "PASS"
assert payload["evidence"]["account"] == "mock"
assert payload["evidence"]["ticker"] == "005930"
assert payload["evidence"]["dry_run"] is True
def test_validate_kis_api_credentials_fails_when_api_call_errors(tmp_path, monkeypatch):