Harden portable Redmine CLI runtime and cache writes
This commit is contained in:
@@ -9,9 +9,18 @@ import pytest
|
||||
import redmine_ticket_nmi
|
||||
|
||||
|
||||
def test_runtime_profile_honors_explicit_production_mode_and_env_file(tmp_path):
|
||||
def test_runtime_profile_honors_explicit_production_mode_and_env_file(tmp_path, monkeypatch):
|
||||
production_env = tmp_path / "production.env"
|
||||
production_env.write_text("NMI_ENDPOINT_PRODUCTION=https://app.ldrprep.com/api.php\n")
|
||||
# File existence alone is no longer readiness. Simulate the offline PHP
|
||||
# diagnostic here; real CLI resolution is exercised by the integration tests.
|
||||
import json
|
||||
import subprocess
|
||||
monkeypatch.setattr(redmine_ticket_nmi.subprocess, "run", lambda cmd, **kwargs:
|
||||
subprocess.CompletedProcess(cmd, 0, json.dumps({
|
||||
"ready": True, "mode": "production", "env_file": str(production_env),
|
||||
"endpoint": "https://app.ldrprep.com/api.php", "problem": None,
|
||||
}), ""))
|
||||
|
||||
profile = redmine_ticket_nmi.resolve_runtime_profile(
|
||||
environ={
|
||||
|
||||
Reference in New Issue
Block a user