sync: auto-sync from HOWARD-HOME at 2026-06-25 13:43:47
Author: Howard Enos Machine: HOWARD-HOME Timestamp: 2026-06-25 13:43:47
This commit is contained in:
@@ -16,6 +16,10 @@ import sys
|
||||
HERE = os.path.dirname(os.path.abspath(__file__))
|
||||
GZ = os.path.join(HERE, "gz.py")
|
||||
ACG = "5c428b246c031893678b4569" # ACG internal company (real)
|
||||
# Valid-FORMAT (24-char hex) placeholder id. Non-existent on the tenant but it
|
||||
# passes client-side _require_oid so gate-refusal tests reach the gate (rc3)
|
||||
# instead of short-circuiting on id validation (rc2). Never used with --confirm.
|
||||
VID = "0123456789abcdef01234567"
|
||||
|
||||
results = []
|
||||
|
||||
@@ -96,15 +100,20 @@ check("policy bad id -> rc2 (client-side)", ["policy", "bogus"], want_rc=2, err_
|
||||
check("quarantine missing --company -> rc2", ["quarantine"], want_rc=2)
|
||||
check("endpoint missing positional -> rc2", ["endpoint"], want_rc=2)
|
||||
|
||||
# --- gating: destructive without --confirm -> rc3, no API call ---
|
||||
check("isolate no confirm -> rc3", ["isolate", "--endpoints", "x"], want_rc=3, err_has="Would")
|
||||
check("unisolate no confirm -> rc3", ["unisolate", "--endpoints", "x"], want_rc=3)
|
||||
# --- gating: destructive without --confirm -> rc3, no API call (valid-format ids
|
||||
# so the gate is reached; id validation is tested separately below) ---
|
||||
check("isolate no confirm -> rc3", ["isolate", "--endpoints", VID], want_rc=3, err_has="Would")
|
||||
check("unisolate no confirm -> rc3", ["unisolate", "--endpoints", VID], want_rc=3)
|
||||
check("blocklist-add no confirm -> rc3", ["blocklist-add", "--company", ACG, "--hashes", "abc"], want_rc=3)
|
||||
check("blocklist-remove no confirm -> rc3", ["blocklist-remove", "--id", "x"], want_rc=3)
|
||||
check("delete-endpoint no confirm -> rc3", ["delete-endpoint", "x"], want_rc=3)
|
||||
check("delete-endpoint no confirm -> rc3", ["delete-endpoint", VID], want_rc=3)
|
||||
check("delete-package no confirm -> rc3", ["delete-package", "--id", "x"], want_rc=3)
|
||||
check("delete-group no confirm -> rc3", ["delete-group", "--group", "x"], want_rc=3)
|
||||
check("assign-policy no confirm -> rc3", ["assign-policy", "--policy", "p", "--targets", "x"], want_rc=3, err_has="Would")
|
||||
check("delete-group no confirm -> rc3", ["delete-group", "--group", VID], want_rc=3)
|
||||
check("assign-policy no confirm -> rc3", ["assign-policy", "--policy", VID, "--targets", VID], want_rc=3, err_has="Would")
|
||||
# id validation runs BEFORE the gate: a malformed id on a gated cmd -> rc2 (not rc3)
|
||||
check("delete-endpoint bad id -> rc2", ["delete-endpoint", "x"], want_rc=2, err_has="not a valid")
|
||||
check("isolate bad id -> rc2", ["isolate", "--endpoints", "x", "--confirm"], want_rc=2, err_has="not a valid")
|
||||
check("company-delete bad id -> rc2", ["company-delete", "--id", "x", "--confirm"], want_rc=2, err_has="not a valid")
|
||||
check("push-set no confirm -> rc3", ["push-set", "--status", "1", "--url", "https://x/y"], want_rc=3)
|
||||
check("push-set enable no url -> rc2", ["push-set", "--status", "1", "--confirm"], want_rc=2)
|
||||
check("raw assignPolicy no confirm -> rc3", ["raw", "--module", "network", "--method", "assignPolicy", "--params", "{}"], want_rc=3)
|
||||
@@ -130,25 +139,25 @@ check("raw createCustomRule no confirm -> rc3", ["raw", "--module", "incidents",
|
||||
|
||||
# --- network completion ---
|
||||
check("endpoint-tags", ["endpoint-tags"], want_rc=0)
|
||||
check("set-label no confirm -> rc3", ["set-label", "--endpoint", "x", "--label", "y"], want_rc=3)
|
||||
check("reconfigure no confirm -> rc3", ["reconfigure", "--targets", "x"], want_rc=3)
|
||||
check("set-label no confirm -> rc3", ["set-label", "--endpoint", VID, "--label", "y"], want_rc=3)
|
||||
check("reconfigure no confirm -> rc3", ["reconfigure", "--targets", VID], want_rc=3)
|
||||
check("raw reconfigure no confirm -> rc3", ["raw", "--module", "network", "--method", "createReconfigureClientTask", "--params", "{}"], want_rc=3)
|
||||
check("raw setEndpointLabel no confirm -> rc3", ["raw", "--module", "network", "--method", "setEndpointLabel", "--params", "{}"], want_rc=3)
|
||||
|
||||
# --- companies module ---
|
||||
check("company (own, no id)", ["company"], want_rc=0)
|
||||
check("company-create no confirm -> rc3", ["company-create", "--type", "1", "--name", "Test Co"], want_rc=3, err_has="Would")
|
||||
check("company-suspend no confirm -> rc3", ["company-suspend", "--id", "x"], want_rc=3)
|
||||
check("company-activate no confirm -> rc3", ["company-activate", "--id", "x"], want_rc=3)
|
||||
check("company-delete no confirm -> rc3", ["company-delete", "--id", "x"], want_rc=3)
|
||||
check("company-suspend no confirm -> rc3", ["company-suspend", "--id", VID], want_rc=3)
|
||||
check("company-activate no confirm -> rc3", ["company-activate", "--id", VID], want_rc=3)
|
||||
check("company-delete no confirm -> rc3", ["company-delete", "--id", VID], want_rc=3)
|
||||
check("raw createCompany no confirm -> rc3", ["raw", "--module", "companies", "--method", "createCompany", "--params", "{}"], want_rc=3)
|
||||
|
||||
# --- accounts module ---
|
||||
check("account (own, no id)", ["account"], want_rc=0)
|
||||
check("account-create no confirm -> rc3", ["account-create", "--email", "t@x.io"], want_rc=3, err_has="Would")
|
||||
check("account-update no confirm -> rc3", ["account-update", "--id", "a", "--set-json", "{\"role\":5}"], want_rc=3)
|
||||
check("account-update bad json -> rc2", ["account-update", "--id", "a", "--set-json", "{bad", "--confirm"], want_rc=2)
|
||||
check("account-delete no confirm -> rc3", ["account-delete", "--id", "a"], want_rc=3)
|
||||
check("account-update no confirm -> rc3", ["account-update", "--id", VID, "--set-json", "{\"role\":5}"], want_rc=3)
|
||||
check("account-update bad json -> rc2", ["account-update", "--id", VID, "--set-json", "{bad", "--confirm"], want_rc=2)
|
||||
check("account-delete no confirm -> rc3", ["account-delete", "--id", VID], want_rc=3)
|
||||
check("notif-configure no confirm -> rc3", ["notif-configure", "--settings-json", "{\"deleteAfter\":7}"], want_rc=3)
|
||||
check("raw createAccount no confirm -> rc3", ["raw", "--module", "accounts", "--method", "createAccount", "--params", "{}"], want_rc=3)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user