mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-11-17 04:11:35 +00:00
Change-detectors, tautologies, source-reading tests, redundant duplicates, mock-echo tests and dead/unrunnable tests. Per-test rationale in the lane ledger (category + reason for every removal).
59 lines
1.7 KiB
Python
59 lines
1.7 KiB
Python
"""Tests for build_nous_credits_snapshot (L6-A, magnitudes-only)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from agent.account_usage import build_nous_credits_snapshot
|
|
from hermes_cli.nous_account import (
|
|
NousPaidServiceAccessInfo,
|
|
NousPortalAccountInfo,
|
|
NousPortalSubscriptionInfo,
|
|
)
|
|
|
|
|
|
def _account(**kwargs) -> NousPortalAccountInfo:
|
|
kwargs.setdefault("logged_in", True)
|
|
kwargs.setdefault("source", "account_api")
|
|
kwargs.setdefault("fresh", True)
|
|
return NousPortalAccountInfo(**kwargs)
|
|
|
|
|
|
def _all_lines(snapshot) -> list[str]:
|
|
return list(snapshot.details)
|
|
|
|
|
|
def test_healthy():
|
|
info = _account(
|
|
paid_service_access=True,
|
|
paid_service_access_info=NousPaidServiceAccessInfo(
|
|
subscription_credits_remaining=18.0,
|
|
purchased_credits_remaining=12.34,
|
|
total_usable_credits=30.34,
|
|
),
|
|
subscription=NousPortalSubscriptionInfo(
|
|
plan="Pro",
|
|
current_period_end="2026-07-01",
|
|
),
|
|
)
|
|
snap = build_nous_credits_snapshot(info)
|
|
assert snap is not None
|
|
assert snap.available is True
|
|
assert snap.plan == "Pro"
|
|
assert snap.provider == "nous"
|
|
blob = "\n".join(_all_lines(snap))
|
|
assert "$18.00" in blob
|
|
assert "$12.34" in blob
|
|
assert "$30.34" in blob
|
|
assert "2026-07-01" in blob
|
|
# money-rule: magnitudes-only, never a percentage
|
|
assert "%" not in blob
|
|
|
|
|
|
def test_logged_out():
|
|
info = _account(
|
|
logged_in=False,
|
|
paid_service_access=True,
|
|
paid_service_access_info=NousPaidServiceAccessInfo(
|
|
total_usable_credits=10.0,
|
|
),
|
|
)
|
|
assert build_nous_credits_snapshot(info) is None
|