diff --git a/integration_test.go b/integration_test.go index f91d6db..08e6286 100644 --- a/integration_test.go +++ b/integration_test.go @@ -6,6 +6,7 @@ import ( "context" "encoding/json" "net/http" + "os" "testing" "time" @@ -67,11 +68,14 @@ func TestIntegrationWebhooksCRUD(t *testing.T) { require.NoError(t, err) } + domain := os.Getenv("MG_DOMAIN") + require.NotEmpty(t, domain) + const name = "permanent_fail" ctx := context.Background() urls := []string{"https://example.com/1", "https://example.com/2"} - err = mg.DeleteWebhook(ctx, name) + err = mg.DeleteWebhook(ctx, domain, name) if err != nil { // 200 or 404 is expected status := mailgun.GetStatusFromErr(err) @@ -81,18 +85,18 @@ func TestIntegrationWebhooksCRUD(t *testing.T) { defer func() { // Cleanup - _ = mg.DeleteWebhook(ctx, name) + _ = mg.DeleteWebhook(ctx, domain, name) }() // Act - err = mg.CreateWebhook(ctx, name, urls) + err = mg.CreateWebhook(ctx, domain, name, urls) require.NoError(t, err) time.Sleep(3 * time.Second) // Assert - gotUrls, err := mg.GetWebhook(ctx, name) + gotUrls, err := mg.GetWebhook(ctx, domain, name) require.NoError(t, err) t.Logf("Webhooks: %v", urls) assert.ElementsMatch(t, urls, gotUrls)