test: trim purge-identity tests to behaviour invariants
Drop the three cases that pin trivia the invariant tests already cover (idempotence is exercised by the routing-store test; the empty-name / no-store guard and the default-profile refusal are one-line argument checks). Salvage bar: invariants only.
This commit is contained in:
@@ -121,11 +121,3 @@ def test_purge_verb_drops_routing_identity_and_reports_ok(tmp_path):
|
||||
"SELECT COUNT(*) AS n FROM gateway_heartbeats WHERE profile = ?", ("gone",))["n"] == 0
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
|
||||
def test_purge_verb_refuses_without_a_name_or_store():
|
||||
"""A malformed request or a gateway with no store answers failure — never a silent success."""
|
||||
from gateway.run_profile_reconcile import purge_profile_identity_verb
|
||||
no_store = purge_profile_identity_verb(SimpleNamespace(session_store=None))
|
||||
assert no_store({})["ok"] is False
|
||||
assert no_store({"name": "gone"})["ok"] is False
|
||||
|
||||
@@ -53,12 +53,6 @@ def test_purge_identity_exits_nonzero_when_settlement_stays_pending(
|
||||
assert "hermes profile purge-identity gone" in capsys.readouterr().err
|
||||
|
||||
|
||||
def test_purge_identity_rejects_the_default_profile(profile_env, capsys):
|
||||
with pytest.raises(SystemExit):
|
||||
profile_cmd.cmd_profile(Namespace(profile_action="purge-identity", profile_name="default"))
|
||||
assert "named profiles only" in capsys.readouterr().out
|
||||
|
||||
|
||||
def test_purge_identity_refuses_a_same_name_profile_created_after_the_delete(profile_env, capsys):
|
||||
"""The retry must not purge identity out from under a profile that exists again.
|
||||
|
||||
|
||||
@@ -150,10 +150,3 @@ class TestPurgeProfileState:
|
||||
routing = db.load_gateway_routing_entries(scope="/root/sessions")
|
||||
assert "agent:foo_bar:feishu:dm:chatA" not in routing
|
||||
assert "agent:fooXbar:feishu:dm:chatB" in routing
|
||||
|
||||
def test_purge_is_idempotent(self, db):
|
||||
db.register_backend_heartbeat(
|
||||
backend_id="be1", pid=1, started_at=time.time(), profile="gone", host="h")
|
||||
|
||||
assert db.purge_profile_state("gone")["gateway_heartbeats"] == 1
|
||||
assert db.purge_profile_state("gone")["gateway_heartbeats"] == 0
|
||||
|
||||
Reference in New Issue
Block a user