mirror of
https://github.com/Yuyi-Oak/BlueArchiveToolkit.git
synced 2026-09-18 10:04:55 +08:00
fix(release):完善当前分发证明与质量门禁
This commit is contained in:
@@ -249,6 +249,101 @@ func TestParseTextUnitsSendsQuery(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestReleaseAttestationMirrorsCurrentOfficialHealth(t *testing.T) {
|
||||
client := newTestClient(t, func(t *testing.T, req testRequest) testResponse {
|
||||
if req.Method != "release.attestation" {
|
||||
t.Fatalf("method = %s", req.Method)
|
||||
}
|
||||
return testResponse{
|
||||
Result: testEnvelope{
|
||||
OK: true,
|
||||
Status: "ok",
|
||||
Data: map[string]any{
|
||||
"available": true,
|
||||
"channel": "official",
|
||||
"release_id": "official-a",
|
||||
"resource_root": "/srv/official/versions/official-a",
|
||||
"publication_identity": "odp-v1-publication-a",
|
||||
"mapping_identity": "odm-v1-mapping-a",
|
||||
"manifest_identity": "manifest-a",
|
||||
"entry_count": 2,
|
||||
"integrity_status": "verified",
|
||||
"status": "ready",
|
||||
"status_code": "distribution.ready",
|
||||
"ready": true,
|
||||
"verification_generation": 7,
|
||||
"verified_at": 1234,
|
||||
"max_age_seconds": 900,
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
report, err := client.ReleaseAttestation(context.Background())
|
||||
if err != nil {
|
||||
t.Fatalf("ReleaseAttestation error: %v", err)
|
||||
}
|
||||
if !report.Ready || report.ReleaseID != "official-a" ||
|
||||
report.ManifestIdentity != "manifest-a" ||
|
||||
report.VerificationGeneration != 7 {
|
||||
t.Fatalf("report = %#v", report)
|
||||
}
|
||||
}
|
||||
|
||||
func TestResourceManifestSendsAttestedGenerationParams(t *testing.T) {
|
||||
client := newTestClient(t, func(t *testing.T, req testRequest) testResponse {
|
||||
if req.Method != "resource.manifest" {
|
||||
t.Fatalf("method = %s", req.Method)
|
||||
}
|
||||
var params ResourceManifestParams
|
||||
if err := json.Unmarshal(req.Params, ¶ms); err != nil {
|
||||
t.Fatalf("decode params: %v", err)
|
||||
}
|
||||
if params.ReleaseID != "official-a" ||
|
||||
params.ExpectedPublicationIdentity != "odp-v1-publication-a" ||
|
||||
params.ExpectedManifestIdentity != "manifest-a" ||
|
||||
params.Offset != 1 || params.Limit != 100 {
|
||||
t.Fatalf("params = %#v", params)
|
||||
}
|
||||
return testResponse{
|
||||
Result: testEnvelope{
|
||||
OK: true,
|
||||
Status: "ok",
|
||||
Data: map[string]any{
|
||||
"available": true,
|
||||
"channel": "official",
|
||||
"release_id": "official-a",
|
||||
"resource_root": "/srv/official/versions/official-a",
|
||||
"manifest_version": 1,
|
||||
"publication_identity": "odp-v1-publication-a",
|
||||
"mapping_identity": "odm-v1-mapping-a",
|
||||
"manifest_identity": "manifest-a",
|
||||
"generation": 7,
|
||||
"total_entries": 2,
|
||||
"offset": 1,
|
||||
"limit": 100,
|
||||
"entries": []any{},
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
page, err := client.ResourceManifest(context.Background(), ResourceManifestParams{
|
||||
ReleaseID: "official-a",
|
||||
ExpectedPublicationIdentity: "odp-v1-publication-a",
|
||||
ExpectedManifestIdentity: "manifest-a",
|
||||
Offset: 1,
|
||||
Limit: 100,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("ResourceManifest error: %v", err)
|
||||
}
|
||||
if page.ReleaseID != "official-a" || page.ManifestIdentity != "manifest-a" ||
|
||||
page.Generation != 7 {
|
||||
t.Fatalf("page = %#v", page)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUnityFSPatchFieldSendsTaggedReplacement(t *testing.T) {
|
||||
client := newTestClient(t, func(t *testing.T, req testRequest) testResponse {
|
||||
if req.Method != "unityfs.patch_field" {
|
||||
|
||||
Reference in New Issue
Block a user