github.com/stripe/stripe-go/v76@v76.25.0/person/client_test.go (about) 1 package person 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 TestPersonDel(t *testing.T) { 12 person, err := Del("person_123", &stripe.PersonParams{ 13 Account: stripe.String("acct_123"), 14 }) 15 assert.Nil(t, err) 16 assert.NotNil(t, person) 17 } 18 19 func TestPersonGet(t *testing.T) { 20 person, err := Get("person_123", &stripe.PersonParams{ 21 Account: stripe.String("acct_123"), 22 }) 23 assert.Nil(t, err) 24 assert.NotNil(t, person) 25 } 26 27 func TestPersonList(t *testing.T) { 28 i := List(&stripe.PersonListParams{ 29 Account: stripe.String("acct_123"), 30 Relationship: &stripe.PersonListRelationshipParams{ 31 Owner: stripe.Bool(true), 32 }, 33 }) 34 35 // Verify that we can get at least one person 36 assert.True(t, i.Next()) 37 assert.Nil(t, i.Err()) 38 assert.NotNil(t, i.Person()) 39 assert.NotNil(t, i.PersonList()) 40 } 41 42 func TestPersonNew(t *testing.T) { 43 person, err := New(&stripe.PersonParams{ 44 Account: stripe.String("acct_123"), 45 FirstName: stripe.String("John"), 46 Relationship: &stripe.PersonRelationshipParams{ 47 Owner: stripe.Bool(true), 48 }, 49 Verification: &stripe.PersonVerificationParams{ 50 Document: &stripe.PersonVerificationDocumentParams{ 51 Back: stripe.String("file_123"), 52 Front: stripe.String("file_234"), 53 }, 54 }, 55 }) 56 assert.Nil(t, err) 57 assert.NotNil(t, person) 58 } 59 60 func TestPersonUpdate(t *testing.T) { 61 person, err := Update("person_123", &stripe.PersonParams{ 62 Account: stripe.String("acct_123"), 63 FirstName: stripe.String("John"), 64 }) 65 assert.Nil(t, err) 66 assert.NotNil(t, person) 67 }