github.com/stripe/stripe-go/v76@v76.25.0/webhookendpoint/client_test.go (about) 1 package webhookendpoint 2 3 import ( 4 "testing" 5 6 assert "github.com/stretchr/testify/require" 7 stripe "github.com/stripe/stripe-go/v76" 8 _ "github.com/stripe/stripe-go/v76/testing" 9 ) 10 11 func TestWebhookEndpointDel(t *testing.T) { 12 endpoint, err := Del("we_123", nil) 13 assert.Nil(t, err) 14 assert.NotNil(t, endpoint) 15 } 16 17 func TestWebhookEndpointGet(t *testing.T) { 18 endpoint, err := Get("we_123", nil) 19 assert.Nil(t, err) 20 assert.NotNil(t, endpoint) 21 } 22 23 func TestWebhookEndpointList(t *testing.T) { 24 i := List(&stripe.WebhookEndpointListParams{}) 25 26 // Verify that we can get at least one webhook endpoint 27 assert.True(t, i.Next()) 28 assert.Nil(t, i.Err()) 29 assert.NotNil(t, i.WebhookEndpoint()) 30 assert.NotNil(t, i.WebhookEndpointList()) 31 } 32 33 func TestWebhookEndpointNew(t *testing.T) { 34 endpoint, err := New(&stripe.WebhookEndpointParams{ 35 EnabledEvents: stripe.StringSlice([]string{ 36 "charge.succeeded", 37 }), 38 URL: stripe.String("https://stripe.com"), 39 }) 40 assert.Nil(t, err) 41 assert.NotNil(t, endpoint) 42 } 43 44 func TestWebhookEndpointUpdate(t *testing.T) { 45 endpoint, err := Update("we_123", &stripe.WebhookEndpointParams{ 46 EnabledEvents: stripe.StringSlice([]string{ 47 "charge.succeeded", 48 }), 49 }) 50 assert.Nil(t, err) 51 assert.NotNil(t, endpoint) 52 }