MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / markEventForUnmarkTest

Function markEventForUnmarkTest

internal/server/cloud_admin_gate_test.go:272–293  ·  view source on GitHub ↗

markEventForUnmarkTest is a helper that POSTs stripe-event-processed and returns the processed_at token the response hands back. Keeps the setup of the unmark tests focused on the unmark semantics.

(t *testing.T, srv *Server, eventID, secret string)

Source from the content-addressed store, hash-verified

270// returns the processed_at token the response hands back. Keeps the setup
271// of the unmark tests focused on the unmark semantics.
272func markEventForUnmarkTest(t *testing.T, srv *Server, eventID, secret string) string {
273 t.Helper()
274 req := cloudAdminReq(t, "POST", "/api/v1/admin/stripe-event-processed", map[string]string{
275 "event_id": eventID,
276 "cloud_secret": secret,
277 }, map[string]string{"X-Cloud-Secret": secret})
278 rr := httptest.NewRecorder()
279 srv.ServeHTTP(rr, req)
280 if rr.Code != http.StatusOK {
281 t.Fatalf("mark %s: %d %s", eventID, rr.Code, rr.Body.String())
282 }
283 var resp struct {
284 ProcessedAt string `json:"processed_at"`
285 }
286 if err := json.Unmarshal(rr.Body.Bytes(), &resp); err != nil {
287 t.Fatalf("decode mark response: %v", err)
288 }
289 if resp.ProcessedAt == "" {
290 t.Fatalf("mark response missing processed_at")
291 }
292 return resp.ProcessedAt
293}
294
295// TestStripeEventUnmark_RoundTripWithMarkProcessed is the happy-path
296// regression for TASK-736: a row previously written by /stripe-event-processed

Calls 3

cloudAdminReqFunction · 0.85
StringMethod · 0.80
ServeHTTPMethod · 0.45

Tested by

no test coverage detected