@@ -304,6 +304,42 @@ func TestSecureCellLaunchClosureAutomationAckReceiptCSVRows_EmptyColumnCount(t *
304304 }
305305}
306306
307+ func TestSecureCellLaunchClosureAutomationAckReceiptManifestCSVRows_EmptyColumnCount(t *testing.T) {
308+ receiptDueAt := time.Unix(1, 0).UTC()
309+ manifest := &securecellsintegration.SecureCellGovernmentAgentExecutionLaunchClosureAutomationAcknowledgementReceiptManifest{
310+ ManifestID: "government-agent-execution-launch-closure-automation-acknowledgement-receipt-manifest:UAE:abcdef123456",
311+ AcknowledgementReceiptID: "government-agent-execution-launch-closure-automation-acknowledgement-receipt:UAE:abcdef123456",
312+ AcknowledgementID: "government-agent-execution-launch-closure-automation-acknowledgement:UAE:abcdef123456",
313+ DirectiveID: "government-agent-execution-launch-closure-automation-directive:UAE:abcdef123456",
314+ DispatchID: "government-agent-execution-launch-closure-automation-dispatch:UAE:abcdef123456",
315+ BriefID: "government-agent-execution-launch-closure-automation-brief:UAE:abcdef123456",
316+ RunbookID: "government-agent-execution-launch-closure-automation-runbook:UAE:abcdef123456",
317+ PacketID: "government-agent-execution-launch-closure-automation-packet:UAE:abcdef123456",
318+ BoardID: "government-agent-execution-launch-closure-automation-board:UAE:abcdef123456",
319+ SummaryID: "government-agent-execution-launch-closure-automation-summary:UAE:abcdef123456",
320+ Jurisdiction: "UAE",
321+ EvaluatedAt: time.Unix(2, 0).UTC(),
322+ FocusLane: securecellsintegration.SecureCellGovernmentAgentExecutionLaunchClosureAutomationBoardLaneDue,
323+ FocusAction: "work_next_due_closure_actions",
324+ Severity: securecellsintegration.SecureCellGovernmentAgentExecutionLaunchClosureAutomationBriefSeverityMedium,
325+ ReceiptStatus: securecellsintegration.SecureCellGovernmentAgentExecutionLaunchClosureAutomationAcknowledgementReceiptStatusOverdue,
326+ ReceiptAction: "recover_missing_launch_closure_ack_receipt",
327+ ReceiptDueAt: &receiptDueAt,
328+ ReceiptOverdueSeconds: 1,
329+ ReceiptDigest: strings.Repeat("a", 64),
330+ ManifestDigest: strings.Repeat("b", 64),
331+ GeneratedAt: time.Unix(3, 0).UTC(),
332+ }
333+
334+ rows := secureCellLaunchClosureAutomationAckReceiptManifestCSVRows(manifest)
335+ if len(rows) != 2 {
336+ t.Fatalf("expected header plus empty-acknowledgement-receipt-manifest row, got %d rows", len(rows))
337+ }
338+ if got, want := len(rows[1]), len(rows[0]); got != want {
339+ t.Fatalf("expected empty-acknowledgement-receipt-manifest csv row to have %d columns, got %d: %#v", want, got, rows[1])
340+ }
341+ }
342+
307343func TestSecureCellsHandlers_BearerCreateGetArtifactsFlow(t *testing.T) {
308344 app := newAuditEnabledTestApp(t, sims.AppOptionsMap{
309345 "aethelred.pqc.mode": "simulated",
@@ -1911,6 +1947,36 @@ func TestSecureCellsHandlers_GovernmentAgentReadinessSurfaces(t *testing.T) {
19111947 if !strings.Contains(launchClosureAutomationAckReceiptExportRec.Body.String(), "receipt_digest") || !strings.Contains(launchClosureAutomationAckReceiptExportRec.Body.String(), createResp.Result.CellID) {
19121948 t.Fatalf("expected government-agent execution launch closure automation acknowledgement receipt csv export, got %s", launchClosureAutomationAckReceiptExportRec.Body.String())
19131949 }
1950+
1951+ launchClosureAutomationAckReceiptManifestReq := httptest.NewRequest(http.MethodGet, secureCellsCollectionRoute+"/government-agent-execution-launch-closure-automation-acknowledgement-receipt-manifest?jurisdiction=UAE&before="+url.QueryEscape(overdueBefore), nil)
1952+ launchClosureAutomationAckReceiptManifestRec := httptest.NewRecorder()
1953+ app.SecureCellsGetHandler().ServeHTTP(launchClosureAutomationAckReceiptManifestRec, launchClosureAutomationAckReceiptManifestReq)
1954+ if launchClosureAutomationAckReceiptManifestRec.Code != http.StatusOK {
1955+ t.Fatalf("expected status %d, got %d body=%s", http.StatusOK, launchClosureAutomationAckReceiptManifestRec.Code, launchClosureAutomationAckReceiptManifestRec.Body.String())
1956+ }
1957+ var launchClosureAutomationAckReceiptManifestResp secureCellLaunchClosureAutomationAckReceiptManifestResponse
1958+ if err := json.Unmarshal(launchClosureAutomationAckReceiptManifestRec.Body.Bytes(), &launchClosureAutomationAckReceiptManifestResp); err != nil {
1959+ t.Fatalf("unmarshal government-agent execution launch closure automation acknowledgement receipt manifest response: %v", err)
1960+ }
1961+ if launchClosureAutomationAckReceiptManifestResp.Manifest == nil || launchClosureAutomationAckReceiptManifestResp.Manifest.OverdueEvidenceCount == 0 {
1962+ t.Fatalf("unexpected government-agent execution launch closure automation acknowledgement receipt manifest response: %+v", launchClosureAutomationAckReceiptManifestResp.Manifest)
1963+ }
1964+ if launchClosureAutomationAckReceiptManifestResp.Manifest.ManifestDigest == "" || launchClosureAutomationAckReceiptManifestResp.Manifest.EvidenceCount == 0 || len(launchClosureAutomationAckReceiptManifestResp.Manifest.Items) == 0 {
1965+ t.Fatalf("expected digest-bound execution launch closure automation acknowledgement receipt manifest, got %+v", launchClosureAutomationAckReceiptManifestResp.Manifest)
1966+ }
1967+ if launchClosureAutomationAckReceiptManifestResp.Manifest.AcknowledgementReceiptID == "" || len(launchClosureAutomationAckReceiptManifestResp.Manifest.Items[0].CellIDs) == 0 {
1968+ t.Fatalf("expected populated execution launch closure automation acknowledgement receipt manifest, got %+v", launchClosureAutomationAckReceiptManifestResp.Manifest)
1969+ }
1970+
1971+ launchClosureAutomationAckReceiptManifestExportReq := httptest.NewRequest(http.MethodGet, secureCellsCollectionRoute+"/government-agent-execution-launch-closure-automation-acknowledgement-receipt-manifest/export?format=csv&jurisdiction=UAE&before="+url.QueryEscape(overdueBefore), nil)
1972+ launchClosureAutomationAckReceiptManifestExportRec := httptest.NewRecorder()
1973+ app.SecureCellsGetHandler().ServeHTTP(launchClosureAutomationAckReceiptManifestExportRec, launchClosureAutomationAckReceiptManifestExportReq)
1974+ if launchClosureAutomationAckReceiptManifestExportRec.Code != http.StatusOK {
1975+ t.Fatalf("expected status %d, got %d body=%s", http.StatusOK, launchClosureAutomationAckReceiptManifestExportRec.Code, launchClosureAutomationAckReceiptManifestExportRec.Body.String())
1976+ }
1977+ if !strings.Contains(launchClosureAutomationAckReceiptManifestExportRec.Body.String(), "manifest_digest") || !strings.Contains(launchClosureAutomationAckReceiptManifestExportRec.Body.String(), createResp.Result.CellID) {
1978+ t.Fatalf("expected government-agent execution launch closure automation acknowledgement receipt manifest csv export, got %s", launchClosureAutomationAckReceiptManifestExportRec.Body.String())
1979+ }
19141980}
19151981
19161982func TestSecureCellsHandlers_BearerFederationLifecycleFlow(t *testing.T) {
0 commit comments