feat: localize license states and restore revoked licenses
Some checks failed
Check / delivery-static (push) Has been cancelled
Check / api (push) Has been cancelled
Check / web (push) Has been cancelled

Co-Authored-By: Craft Agent <agents-noreply@craft.do>
This commit is contained in:
2026-10-12 16:11:09 +08:00
parent f4b99e50cd
commit 09910db251
8 changed files with 141 additions and 6 deletions

View File

@@ -137,4 +137,13 @@ func testHeartbeatMySQL(t *testing.T, db *sql.DB, r *gin.Engine, cookie *http.Co
if response.Data.Payload.State != "revoked" {
t.Fatal("revocation not propagated")
}
restorePath := "/api/v1/licenses/" + strconv.FormatUint(licenseID, 10) + "/restore"
if w = request(restorePath, `{}`, "heartbeat-restore", true); w.Code != 200 {
t.Fatalf("restore=%d body=%s", w.Code, w.Body)
}
w = request(path, body, "restored", false)
json.Unmarshal(w.Body.Bytes(), &response)
if w.Code != 200 || response.Data.Payload.State != "active" {
t.Fatalf("restoration not propagated: %d %s", w.Code, w.Body)
}
}