MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / TestSpecGeneratedFromHandlers

Function TestSpecGeneratedFromHandlers

internal/httpapi/spec_test.go:52–127  ·  view source on GitHub ↗

TestSpecGeneratedFromHandlers is the spec↔server check (api-v1-redesign §6): the OpenAPI document is emitted from the live, registered handlers — never hand-authored — so it cannot drift from what the server actually serves. Every registered operation must appear in the generated spec.

(t *testing.T)

Source from the content-addressed store, hash-verified

50// hand-authored — so it cannot drift from what the server actually serves.
51// Every registered operation must appear in the generated spec.
52func TestSpecGeneratedFromHandlers(t *testing.T) {
53 s := New(Deps{}) // no deps needed to render the spec
54 yaml, err := s.OpenAPIYAML()
55 if err != nil {
56 t.Fatalf("render spec: %v", err)
57 }
58 spec := string(yaml)
59
60 mustContain := []string{
61 "openapi: 3.1.0",
62 "operationId: getInfo",
63 "operationId: listAgents",
64 "operationId: getAgent",
65 "operationId: createAgent",
66 "operationId: updateAgent",
67 "operationId: deleteAgent",
68 "operationId: getMessage",
69 "operationId: listMessages",
70 "operationId: listConversations",
71 "operationId: getConversation",
72 "operationId: listDomains",
73 "operationId: registerDomain",
74 "operationId: deleteDomain",
75 "operationId: verifyDomain",
76 "operationId: createWebhook",
77 "operationId: listWebhooks",
78 "operationId: deleteWebhook",
79 "operationId: updateWebhook",
80 "operationId: rotateWebhookSecret",
81 "operationId: testWebhook",
82 "operationId: listWebhookDeliveries",
83 "operationId: listEvents",
84 "operationId: getEvent",
85 "operationId: redeliverEvent",
86 "operationId: getAccount",
87 "operationId: exportAccount",
88 "operationId: deleteAccount",
89 "operationId: sendMessage",
90 "operationId: replyToMessage",
91 "operationId: forwardMessage",
92 "operationId: approveMessage",
93 "operationId: rejectMessage",
94 "operationId: testAgent",
95 "/v1/account",
96 "/v1/events",
97 "/v1/events/{id}",
98 "/v1/webhooks",
99 "/v1/webhooks/{id}",
100 "/v1/domains/{domain}/verify",
101 "/v1/domains",
102 "/v1/domains/{domain}",
103 "/v1/info",
104 "/v1/agents",
105 "/v1/agents/{email}",
106 "/v1/agents/{email}/messages",
107 "/v1/agents/{email}/messages/{id}",
108 // The single Bearer security scheme is declared.
109 "securitySchemes",

Callers

nothing calls this directly

Calls 2

OpenAPIYAMLMethod · 0.80
NewFunction · 0.70

Tested by

no test coverage detected