mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-11-21 07:55:08 +00:00
feat(debug): add --nous flag to upload diagnostics to Nous S3
`hermes debug share --nous` uploads the (force-redacted) debug bundle to Nous-internal S3 storage via a presigned URL minted by the Nous account service, instead of a public paste. The bundle is private — viewable only by Nous staff / allowlisted mods through a Google-OAuth-gated viewer — and auto-deletes after 14 days. The paste.rs path is unchanged and remains the default. - hermes_cli/diagnostics_upload.py (new): stdlib-urllib NAS client — request_upload_url(), put_bundle(), confirm_upload() (best-effort), share_to_nous() orchestrator. Base URL via HERMES_DIAGNOSTICS_BASE_URL (default https://portal.nousresearch.com). - hermes_cli/debug.py: extract collect_share_bundle() from build_debug_share() so the Nous path reuses the exact same redaction/collection (paste.rs behaviour unchanged); add build_nous_bundle() producing the gzipped {"format":"hermes-debug-share/1","redacted":...,"files":...} envelope the discord-support viewer parses; add the --nous run path with a privacy notice and a clean fallback (suggest --local) on failure. - hermes_cli/main.py: add the --nous flag + help/epilog entry on `debug share`. - tests: test_diagnostics_upload.py (new) mocks urllib; test_debug.py adds bundle/Nous coverage. 97 passing.
This commit is contained in:
parent
b5f8996ccc
commit
bb6474cc51
5 changed files with 806 additions and 68 deletions
|
|
@ -491,6 +491,7 @@ class TestRunDebugShare:
|
|||
args.lines = 50
|
||||
args.expire = 7
|
||||
args.local = False
|
||||
args.nous = False
|
||||
|
||||
with patch("hermes_cli.dump.run_dump"), \
|
||||
patch("hermes_cli.debug._sweep_expired_pastes", return_value=(0, 0)) as mock_sweep, \
|
||||
|
|
@ -509,6 +510,7 @@ class TestRunDebugShare:
|
|||
args.lines = 50
|
||||
args.expire = 7
|
||||
args.local = False
|
||||
args.nous = False
|
||||
|
||||
with patch("hermes_cli.dump.run_dump"), \
|
||||
patch(
|
||||
|
|
@ -529,6 +531,7 @@ class TestRunDebugShare:
|
|||
args.lines = 50
|
||||
args.expire = 7
|
||||
args.local = True
|
||||
args.nous = False
|
||||
|
||||
with patch("hermes_cli.dump.run_dump"):
|
||||
run_debug_share(args)
|
||||
|
|
@ -546,6 +549,7 @@ class TestRunDebugShare:
|
|||
args.lines = 50
|
||||
args.expire = 7
|
||||
args.local = False
|
||||
args.nous = False
|
||||
|
||||
call_count = [0]
|
||||
uploaded_content = []
|
||||
|
|
@ -599,6 +603,7 @@ class TestRunDebugShare:
|
|||
args.lines = 50
|
||||
args.expire = 7
|
||||
args.local = False
|
||||
args.nous = False
|
||||
|
||||
uploaded_content = []
|
||||
|
||||
|
|
@ -644,6 +649,7 @@ class TestRunDebugShare:
|
|||
args.lines = 50
|
||||
args.expire = 7
|
||||
args.local = False
|
||||
args.nous = False
|
||||
|
||||
call_count = [0]
|
||||
def _mock_upload(content, expiry_days=7):
|
||||
|
|
@ -668,6 +674,7 @@ class TestRunDebugShare:
|
|||
args.lines = 50
|
||||
args.expire = 7
|
||||
args.local = False
|
||||
args.nous = False
|
||||
|
||||
call_count = [0]
|
||||
def _mock_upload(content, expiry_days=7):
|
||||
|
|
@ -694,6 +701,7 @@ class TestRunDebugShare:
|
|||
args.lines = 50
|
||||
args.expire = 7
|
||||
args.local = False
|
||||
args.nous = False
|
||||
|
||||
with patch("hermes_cli.dump.run_dump"), \
|
||||
patch("hermes_cli.debug.upload_to_pastebin",
|
||||
|
|
@ -742,6 +750,7 @@ class TestRunDebugShareRedaction:
|
|||
args.lines = 50
|
||||
args.expire = 7
|
||||
args.local = False
|
||||
args.nous = False
|
||||
args.no_redact = False
|
||||
|
||||
captured: list[str] = []
|
||||
|
|
@ -772,6 +781,7 @@ class TestRunDebugShareRedaction:
|
|||
args.lines = 50
|
||||
args.expire = 7
|
||||
args.local = False
|
||||
args.nous = False
|
||||
args.no_redact = False
|
||||
|
||||
captured: list[str] = []
|
||||
|
|
@ -800,6 +810,7 @@ class TestRunDebugShareRedaction:
|
|||
args.lines = 50
|
||||
args.expire = 7
|
||||
args.local = False
|
||||
args.nous = False
|
||||
args.no_redact = True
|
||||
|
||||
captured: list[str] = []
|
||||
|
|
@ -850,6 +861,7 @@ class TestRunDebug:
|
|||
args.lines = 200
|
||||
args.expire = 7
|
||||
args.local = True
|
||||
args.nous = False
|
||||
|
||||
with patch("hermes_cli.dump.run_dump"):
|
||||
run_debug(args)
|
||||
|
|
@ -1228,6 +1240,7 @@ class TestShareIncludesAutoDelete:
|
|||
args.lines = 50
|
||||
args.expire = 7
|
||||
args.local = False
|
||||
args.nous = False
|
||||
|
||||
with patch("hermes_cli.dump.run_dump"), \
|
||||
patch("hermes_cli.debug.upload_to_pastebin",
|
||||
|
|
@ -1250,6 +1263,7 @@ class TestShareIncludesAutoDelete:
|
|||
args.lines = 50
|
||||
args.expire = 7
|
||||
args.local = False
|
||||
args.nous = False
|
||||
|
||||
with patch("hermes_cli.dump.run_dump"), \
|
||||
patch("hermes_cli.debug.upload_to_pastebin",
|
||||
|
|
@ -1267,6 +1281,7 @@ class TestShareIncludesAutoDelete:
|
|||
args.lines = 50
|
||||
args.expire = 7
|
||||
args.local = True
|
||||
args.nous = False
|
||||
|
||||
with patch("hermes_cli.dump.run_dump"):
|
||||
run_debug_share(args)
|
||||
|
|
@ -1380,3 +1395,161 @@ class TestBuildDebugShare:
|
|||
), patch("hermes_cli.debug._schedule_auto_delete"):
|
||||
with pytest.raises(RuntimeError, match="all paste services down"):
|
||||
build_debug_share(log_lines=50, redact=True)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Shared bundle collection + Nous-S3 path
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
class TestCollectShareBundle:
|
||||
def test_returns_report_and_logs(self, hermes_home):
|
||||
from hermes_cli.debug import collect_share_bundle
|
||||
|
||||
with patch("hermes_cli.dump.run_dump"):
|
||||
bundle = collect_share_bundle(log_lines=50, redact=True)
|
||||
|
||||
assert "report" in bundle
|
||||
assert "agent.log" in bundle
|
||||
assert "gateway.log" in bundle
|
||||
assert "desktop.log" in bundle
|
||||
# Banner is prepended under redact=True.
|
||||
assert "redacted at upload time" in bundle["report"]
|
||||
assert "session started" in bundle["agent.log"]
|
||||
|
||||
def test_no_redact_omits_banner(self, hermes_home):
|
||||
from hermes_cli.debug import collect_share_bundle
|
||||
|
||||
with patch("hermes_cli.dump.run_dump"):
|
||||
bundle = collect_share_bundle(log_lines=50, redact=False)
|
||||
|
||||
assert "redacted at upload time" not in bundle["report"]
|
||||
|
||||
def test_redaction_keeps_secrets_out(self, hermes_home):
|
||||
from hermes_cli.debug import collect_share_bundle
|
||||
|
||||
secret = "sk-proj-abcdefghijklmnopqrstuvwxyz1234567890"
|
||||
(hermes_home / "logs" / "agent.log").write_text(
|
||||
f"line one\nOPENAI_API_KEY={secret}\nline three\n"
|
||||
)
|
||||
with patch("hermes_cli.dump.run_dump"):
|
||||
redacted = collect_share_bundle(log_lines=50, redact=True)
|
||||
unredacted = collect_share_bundle(log_lines=50, redact=False)
|
||||
|
||||
# Sanity: without redaction the secret is present in the bundle.
|
||||
assert secret in "\n".join(unredacted.values())
|
||||
# With redaction it must be scrubbed everywhere.
|
||||
assert secret not in "\n".join(redacted.values())
|
||||
|
||||
|
||||
def test_build_debug_share_uses_collector(self, hermes_home):
|
||||
# build_debug_share must produce the same report text the collector does
|
||||
# (i.e. the refactor preserved paste.rs behaviour).
|
||||
from hermes_cli.debug import build_debug_share, collect_share_bundle
|
||||
|
||||
with patch("hermes_cli.dump.run_dump"):
|
||||
expected = collect_share_bundle(log_lines=50, redact=True)["report"]
|
||||
|
||||
uploaded = []
|
||||
|
||||
def _upload(content, expiry_days=7):
|
||||
uploaded.append(content)
|
||||
return "https://paste.rs/x"
|
||||
|
||||
with patch("hermes_cli.dump.run_dump"), patch(
|
||||
"hermes_cli.debug.upload_to_pastebin", side_effect=_upload
|
||||
), patch("hermes_cli.debug._schedule_auto_delete"):
|
||||
result = build_debug_share(log_lines=50, redact=True)
|
||||
|
||||
assert result.urls["Report"] == "https://paste.rs/x"
|
||||
# The report uploaded should match the collector's report.
|
||||
assert uploaded[0] == expected
|
||||
|
||||
|
||||
class TestBuildNousBundle:
|
||||
def test_envelope_shape_and_gzip(self, hermes_home):
|
||||
import gzip
|
||||
import json as _json
|
||||
|
||||
from hermes_cli.debug import build_nous_bundle
|
||||
|
||||
files = {"report": "hello", "agent.log": "log line"}
|
||||
blob = build_nous_bundle(files, redact=True)
|
||||
|
||||
# It's gzip — magic bytes.
|
||||
assert blob[:2] == b"\x1f\x8b"
|
||||
envelope = _json.loads(gzip.decompress(blob).decode())
|
||||
assert envelope["format"] == "hermes-debug-share/1"
|
||||
assert envelope["redacted"] is True
|
||||
assert envelope["files"] == files
|
||||
assert "created" in envelope
|
||||
|
||||
def test_redacted_false_recorded(self):
|
||||
import gzip
|
||||
import json as _json
|
||||
|
||||
from hermes_cli.debug import build_nous_bundle
|
||||
|
||||
blob = build_nous_bundle({"report": "x"}, redact=False)
|
||||
envelope = _json.loads(gzip.decompress(blob).decode())
|
||||
assert envelope["redacted"] is False
|
||||
|
||||
|
||||
class TestRunDebugShareNous:
|
||||
def _args(self, **over):
|
||||
class _A:
|
||||
lines = 50
|
||||
expire = 7
|
||||
local = False
|
||||
nous = True
|
||||
no_redact = False
|
||||
|
||||
a = _A()
|
||||
for k, v in over.items():
|
||||
setattr(a, k, v)
|
||||
return a
|
||||
|
||||
def test_nous_success_prints_view_url(self, hermes_home, capsys):
|
||||
from hermes_cli.debug import run_debug_share
|
||||
|
||||
res = {
|
||||
"id": "id-1",
|
||||
"viewUrl": "https://support.example.com/diagnostics/id-1",
|
||||
"expiresAt": "2026-06-20T00:00:00Z",
|
||||
}
|
||||
with patch("hermes_cli.dump.run_dump"), patch(
|
||||
"hermes_cli.diagnostics_upload.share_to_nous", return_value=res
|
||||
) as share:
|
||||
run_debug_share(self._args())
|
||||
|
||||
out = capsys.readouterr().out
|
||||
assert "Nous-INTERNAL" in out
|
||||
assert "https://support.example.com/diagnostics/id-1" in out
|
||||
assert "2026-06-20T00:00:00Z" in out
|
||||
# The blob passed to share_to_nous must be gzip bytes.
|
||||
blob = share.call_args[0][0]
|
||||
assert isinstance(blob, (bytes, bytearray)) and blob[:2] == b"\x1f\x8b"
|
||||
|
||||
def test_nous_failure_suggests_local(self, hermes_home, capsys):
|
||||
from hermes_cli.debug import run_debug_share
|
||||
|
||||
with patch("hermes_cli.dump.run_dump"), patch(
|
||||
"hermes_cli.diagnostics_upload.share_to_nous",
|
||||
side_effect=RuntimeError("service down"),
|
||||
):
|
||||
with pytest.raises(SystemExit) as exc:
|
||||
run_debug_share(self._args())
|
||||
assert exc.value.code == 1
|
||||
err = capsys.readouterr().err
|
||||
assert "Nous upload failed" in err
|
||||
assert "--local" in err
|
||||
|
||||
def test_nous_does_not_touch_pastebin(self, hermes_home):
|
||||
from hermes_cli.debug import run_debug_share
|
||||
|
||||
res = {"id": "id-1", "viewUrl": "https://v"}
|
||||
with patch("hermes_cli.dump.run_dump"), patch(
|
||||
"hermes_cli.diagnostics_upload.share_to_nous", return_value=res
|
||||
), patch("hermes_cli.debug.upload_to_pastebin") as paste:
|
||||
run_debug_share(self._args())
|
||||
paste.assert_not_called()
|
||||
|
||||
|
|
|
|||
261
tests/hermes_cli/test_diagnostics_upload.py
Normal file
261
tests/hermes_cli/test_diagnostics_upload.py
Normal file
|
|
@ -0,0 +1,261 @@
|
|||
"""Tests for ``hermes_cli.diagnostics_upload`` — the Nous-S3 upload client.
|
||||
|
||||
All network I/O is mocked at ``urllib.request.urlopen``; no real requests
|
||||
are made.
|
||||
"""
|
||||
|
||||
import io
|
||||
import json
|
||||
import urllib.error
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
def _resp(*, status=200, body=b""):
|
||||
"""Build a context-manager mock mimicking ``urllib.request.urlopen``."""
|
||||
m = MagicMock()
|
||||
m.status = status
|
||||
m.getcode.return_value = status
|
||||
m.read.return_value = body
|
||||
m.__enter__ = lambda s: s
|
||||
m.__exit__ = MagicMock(return_value=False)
|
||||
return m
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# request_upload_url
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
class TestRequestUploadUrl:
|
||||
def test_happy_path_posts_json_and_returns_dict(self):
|
||||
from hermes_cli.diagnostics_upload import request_upload_url
|
||||
|
||||
payload = {
|
||||
"success": True,
|
||||
"id": "abc-123",
|
||||
"uploadUrl": "https://bucket.s3.amazonaws.com/uploads/abc-123.json.gz?sig",
|
||||
"viewUrl": "https://support.example.com/diagnostics/abc-123",
|
||||
"uploadExpiresInSeconds": 900,
|
||||
}
|
||||
resp = _resp(status=200, body=json.dumps(payload).encode())
|
||||
|
||||
with patch(
|
||||
"hermes_cli.diagnostics_upload.urllib.request.urlopen",
|
||||
return_value=resp,
|
||||
) as urlopen:
|
||||
result = request_upload_url(content_type="application/gzip", size_bytes=512)
|
||||
|
||||
assert result == payload
|
||||
|
||||
# The request object passed to urlopen carries our JSON body + headers.
|
||||
req = urlopen.call_args[0][0]
|
||||
assert req.method == "POST"
|
||||
assert req.full_url.endswith("/api/diagnostics/upload-url")
|
||||
sent = json.loads(req.data.decode())
|
||||
assert sent["contentType"] == "application/gzip"
|
||||
assert sent["sizeBytes"] == 512
|
||||
# urllib lower-cases header keys.
|
||||
assert req.headers["Content-type"] == "application/json"
|
||||
|
||||
def test_non_2xx_raises(self):
|
||||
from hermes_cli.diagnostics_upload import request_upload_url
|
||||
|
||||
resp = _resp(status=500, body=b"boom")
|
||||
with patch(
|
||||
"hermes_cli.diagnostics_upload.urllib.request.urlopen",
|
||||
return_value=resp,
|
||||
):
|
||||
with pytest.raises(RuntimeError):
|
||||
request_upload_url()
|
||||
|
||||
def test_missing_upload_url_raises(self):
|
||||
from hermes_cli.diagnostics_upload import request_upload_url
|
||||
|
||||
resp = _resp(status=200, body=json.dumps({"id": "x"}).encode())
|
||||
with patch(
|
||||
"hermes_cli.diagnostics_upload.urllib.request.urlopen",
|
||||
return_value=resp,
|
||||
):
|
||||
with pytest.raises(RuntimeError):
|
||||
request_upload_url()
|
||||
|
||||
def test_non_json_raises(self):
|
||||
from hermes_cli.diagnostics_upload import request_upload_url
|
||||
|
||||
resp = _resp(status=200, body=b"<html>not json</html>")
|
||||
with patch(
|
||||
"hermes_cli.diagnostics_upload.urllib.request.urlopen",
|
||||
return_value=resp,
|
||||
):
|
||||
with pytest.raises(RuntimeError):
|
||||
request_upload_url()
|
||||
|
||||
def test_base_url_env_override(self, monkeypatch):
|
||||
# NAS_BASE is read at import time; re-import the module under the
|
||||
# patched env to confirm the override is honoured.
|
||||
import importlib
|
||||
|
||||
monkeypatch.setenv("HERMES_DIAGNOSTICS_BASE_URL", "https://staging.example.com")
|
||||
import hermes_cli.diagnostics_upload as mod
|
||||
|
||||
mod = importlib.reload(mod)
|
||||
try:
|
||||
assert mod.NAS_BASE == "https://staging.example.com"
|
||||
resp = _resp(
|
||||
status=200,
|
||||
body=json.dumps({"uploadUrl": "u", "id": "i", "viewUrl": "v"}).encode(),
|
||||
)
|
||||
with patch(
|
||||
"hermes_cli.diagnostics_upload.urllib.request.urlopen",
|
||||
return_value=resp,
|
||||
) as urlopen:
|
||||
mod.request_upload_url()
|
||||
req = urlopen.call_args[0][0]
|
||||
assert req.full_url == "https://staging.example.com/api/diagnostics/upload-url"
|
||||
finally:
|
||||
monkeypatch.delenv("HERMES_DIAGNOSTICS_BASE_URL", raising=False)
|
||||
importlib.reload(mod)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# put_bundle
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
class TestPutBundle:
|
||||
def test_put_sends_exact_body_and_content_type(self):
|
||||
from hermes_cli.diagnostics_upload import put_bundle
|
||||
|
||||
data = b"\x1f\x8b\x08gzipped-bytes"
|
||||
resp = _resp(status=200, body=b"")
|
||||
|
||||
with patch(
|
||||
"hermes_cli.diagnostics_upload.urllib.request.urlopen",
|
||||
return_value=resp,
|
||||
) as urlopen:
|
||||
put_bundle("https://bucket.s3.amazonaws.com/uploads/x.json.gz?sig", data)
|
||||
|
||||
req = urlopen.call_args[0][0]
|
||||
assert req.method == "PUT"
|
||||
# PUT body must be the bundle bytes, unchanged.
|
||||
assert req.data == data
|
||||
assert req.headers["Content-type"] == "application/gzip"
|
||||
|
||||
def test_custom_content_type(self):
|
||||
from hermes_cli.diagnostics_upload import put_bundle
|
||||
|
||||
resp = _resp(status=204, body=b"")
|
||||
with patch(
|
||||
"hermes_cli.diagnostics_upload.urllib.request.urlopen",
|
||||
return_value=resp,
|
||||
) as urlopen:
|
||||
put_bundle("https://u", b"data", content_type="application/json")
|
||||
req = urlopen.call_args[0][0]
|
||||
assert req.headers["Content-type"] == "application/json"
|
||||
|
||||
def test_non_2xx_raises(self):
|
||||
from hermes_cli.diagnostics_upload import put_bundle
|
||||
|
||||
resp = _resp(status=403, body=b"AccessDenied")
|
||||
with patch(
|
||||
"hermes_cli.diagnostics_upload.urllib.request.urlopen",
|
||||
return_value=resp,
|
||||
):
|
||||
with pytest.raises(RuntimeError):
|
||||
put_bundle("https://u", b"data")
|
||||
|
||||
def test_http_error_propagates(self):
|
||||
from hermes_cli.diagnostics_upload import put_bundle
|
||||
|
||||
err = urllib.error.HTTPError("https://u", 500, "err", {}, io.BytesIO(b""))
|
||||
with patch(
|
||||
"hermes_cli.diagnostics_upload.urllib.request.urlopen",
|
||||
side_effect=err,
|
||||
):
|
||||
with pytest.raises(urllib.error.HTTPError):
|
||||
put_bundle("https://u", b"data")
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# confirm_upload
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
class TestConfirmUpload:
|
||||
def test_confirm_posts(self):
|
||||
from hermes_cli.diagnostics_upload import confirm_upload
|
||||
|
||||
resp = _resp(status=200, body=b"")
|
||||
with patch(
|
||||
"hermes_cli.diagnostics_upload.urllib.request.urlopen",
|
||||
return_value=resp,
|
||||
) as urlopen:
|
||||
confirm_upload("abc-123", 1024)
|
||||
req = urlopen.call_args[0][0]
|
||||
assert req.method == "POST"
|
||||
assert req.full_url.endswith("/api/diagnostics/confirm")
|
||||
sent = json.loads(req.data.decode())
|
||||
assert sent == {"id": "abc-123", "sizeBytes": 1024}
|
||||
|
||||
def test_confirm_failure_is_swallowed(self):
|
||||
from hermes_cli.diagnostics_upload import confirm_upload
|
||||
|
||||
with patch(
|
||||
"hermes_cli.diagnostics_upload.urllib.request.urlopen",
|
||||
side_effect=urllib.error.URLError("connection refused"),
|
||||
):
|
||||
# Must NOT raise.
|
||||
confirm_upload("abc-123", 1024)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# share_to_nous (orchestration)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
class TestShareToNous:
|
||||
def test_orchestrates_request_put_confirm(self):
|
||||
from hermes_cli import diagnostics_upload as mod
|
||||
|
||||
info = {
|
||||
"id": "id-9",
|
||||
"uploadUrl": "https://bucket/uploads/id-9.json.gz?sig",
|
||||
"viewUrl": "https://support/diagnostics/id-9",
|
||||
"expiresAt": "2026-06-20T00:00:00Z",
|
||||
}
|
||||
blob = b"gzipped-bundle"
|
||||
|
||||
with patch.object(mod, "request_upload_url", return_value=info) as req, \
|
||||
patch.object(mod, "put_bundle") as put, \
|
||||
patch.object(mod, "confirm_upload") as confirm:
|
||||
result = mod.share_to_nous(blob)
|
||||
|
||||
assert result == info
|
||||
req.assert_called_once()
|
||||
# request was told the real byte size
|
||||
assert req.call_args.kwargs["size_bytes"] == len(blob)
|
||||
# PUT got the signed URL + the exact blob
|
||||
put.assert_called_once_with(
|
||||
info["uploadUrl"], blob, content_type="application/gzip"
|
||||
)
|
||||
confirm.assert_called_once_with("id-9", len(blob))
|
||||
|
||||
def test_put_failure_propagates(self):
|
||||
from hermes_cli import diagnostics_upload as mod
|
||||
|
||||
info = {"id": "id-9", "uploadUrl": "https://u", "viewUrl": "v"}
|
||||
with patch.object(mod, "request_upload_url", return_value=info), \
|
||||
patch.object(mod, "put_bundle", side_effect=RuntimeError("PUT failed")), \
|
||||
patch.object(mod, "confirm_upload") as confirm:
|
||||
with pytest.raises(RuntimeError):
|
||||
mod.share_to_nous(b"data")
|
||||
# confirm never runs if PUT failed
|
||||
confirm.assert_not_called()
|
||||
|
||||
def test_confirm_skipped_without_id(self):
|
||||
from hermes_cli import diagnostics_upload as mod
|
||||
|
||||
info = {"uploadUrl": "https://u", "viewUrl": "v"} # no id
|
||||
with patch.object(mod, "request_upload_url", return_value=info), \
|
||||
patch.object(mod, "put_bundle"), \
|
||||
patch.object(mod, "confirm_upload") as confirm:
|
||||
mod.share_to_nous(b"data")
|
||||
confirm.assert_not_called()
|
||||
Loading…
Add table
Add a link
Reference in a new issue