MCPcopy Create free account
hub / github.com/asternic/wuzapi / TestWebhookSet

Function TestWebhookSet

stdio_test.go:522–548  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

520}
521
522func TestWebhookSet(t *testing.T) {
523 s := makeTestServer(t)
524
525 // Create a user first
526 addRequest := newRequest("1", "admin.users.add", map[string]interface{}{
527 "adminToken": "test-admin-token",
528 "name": "SetUser",
529 "token": "set-token",
530 }).toJSON(t)
531 executeRequest(t, s, addRequest)
532
533 // Set webhook with events
534 setRequest := newRequest("2", "webhook.set", map[string]interface{}{
535 "token": "set-token",
536 "webhookurl": "http://example.com/webhook",
537 "events": []string{"Message", "Receipt"},
538 }).toJSON(t)
539 setResponse := executeRequest(t, s, setRequest)
540
541 expectedSet := map[string]interface{}{
542 "jsonrpc": "2.0",
543 "id": "2",
544 }
545 if diff := compareJSON(expectedSet, setResponse); diff != "" {
546 t.Errorf("Set response mismatch:\n%s", diff)
547 }
548}
549
550func TestWebhookDelete(t *testing.T) {
551 s := makeTestServer(t)

Callers

nothing calls this directly

Calls 5

makeTestServerFunction · 0.85
newRequestFunction · 0.85
executeRequestFunction · 0.85
compareJSONFunction · 0.85
toJSONMethod · 0.80

Tested by

no test coverage detected