(ctx context.Context, t *testing.T, phoneNumber string, events []string)
| 118 | } |
| 119 | |
| 120 | func setupWebhook(ctx context.Context, t *testing.T, phoneNumber string, events []string) (signingKey string, webhookPath string) { |
| 121 | t.Helper() |
| 122 | |
| 123 | signingKey = randomEncryptionKey() |
| 124 | webhookPath = "/webhooks/" + uuid.New().String() |
| 125 | webhookURL := wiremockWebhookURL + webhookPath |
| 126 | |
| 127 | client := newAPIClient() |
| 128 | _, resp, err := client.Webhooks.Store(ctx, &httpsms.WebhookStoreParams{ |
| 129 | SigningKey: signingKey, |
| 130 | URL: webhookURL, |
| 131 | PhoneNumbers: []string{phoneNumber}, |
| 132 | Events: events, |
| 133 | }) |
| 134 | require.NoError(t, err) |
| 135 | require.Equal(t, http.StatusCreated, resp.HTTPResponse.StatusCode, "webhook store failed") |
| 136 | |
| 137 | return signingKey, webhookPath |
| 138 | } |
| 139 | |
| 140 | func fireEvent(ctx context.Context, t *testing.T, phoneAPIKey string, messageID string, eventName string) { |
| 141 | t.Helper() |
no test coverage detected