MCPcopy Create free account
hub / github.com/openclaw/gogcli / TestHTTPHandlerProcessesPush

Function TestHTTPHandlerProcessesPush

internal/gmailwatch/http_test.go:15–43  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

13)
14
15func TestHTTPHandlerProcessesPush(t *testing.T) {
16 t.Parallel()
17
18 handler := &HTTPHandler{
19 Config: HTTPConfig{
20 Path: "/hook",
21 Account: "a@example.com",
22 BodyLimit: 1024,
23 HasHook: true,
24 },
25 Authorize: func(*http.Request) bool {
26 return true
27 },
28 Process: func(_ context.Context, notification Notification) (*ProcessedPayload, error) {
29 if notification.HistoryID != "200" || notification.MessageID != "push-1" {
30 t.Fatalf("notification = %#v", notification)
31 }
32
33 return &ProcessedPayload{Payload: &Payload{HistoryID: "200"}}, nil
34 },
35 }
36
37 response := httptest.NewRecorder()
38 handler.ServeHTTP(response, pushRequest(t, "a@example.com", "200", "push-1"))
39
40 if response.Code != http.StatusOK {
41 t.Fatalf("status = %d", response.Code)
42 }
43}
44
45func TestHTTPHandlerMapsNoMessagesAndRateLimit(t *testing.T) {
46 t.Parallel()

Callers

nothing calls this directly

Calls 2

ServeHTTPMethod · 0.95
pushRequestFunction · 0.85

Tested by

no test coverage detected