Skip to content

Commit

Permalink
Updated tests and stripe.go, not sure how this was passing locally. D…
Browse files Browse the repository at this point in the history
…id not update branch when switching environments
  • Loading branch information
natdm committed Oct 16, 2017
1 parent e611f43 commit 58e3196
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 9 additions & 9 deletions stripe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

func TestCheckinUseBearerAuth(t *testing.T) {
c := &stripe.BackendConfiguration{URL: stripe.APIURL}
c := &stripe.BackendConfiguration{Mutex: &sync.Mutex{}, URL: stripe.APIURL}
key := "apiKey"

req, err := c.NewRequest("", "", key, "", nil, nil)
Expand All @@ -30,7 +30,7 @@ func TestMultipleAPICalls(t *testing.T) {
wg.Add(1)
go func() {
defer wg.Done()
c := &stripe.BackendConfiguration{URL: stripe.APIURL}
c := &stripe.BackendConfiguration{Mutex: &sync.Mutex{}, URL: stripe.APIURL}
key := "apiKey"

req, err := c.NewRequest("", "", key, "", nil, nil)
Expand All @@ -43,7 +43,7 @@ func TestMultipleAPICalls(t *testing.T) {
}

func TestIdempotencyKey(t *testing.T) {
c := &stripe.BackendConfiguration{URL: stripe.APIURL}
c := &stripe.BackendConfiguration{Mutex: &sync.Mutex{}, URL: stripe.APIURL}
p := &stripe.Params{IdempotencyKey: "idempotency-key"}

req, err := c.NewRequest("", "", "", "", nil, p)
Expand All @@ -53,7 +53,7 @@ func TestIdempotencyKey(t *testing.T) {
}

func TestStripeAccount(t *testing.T) {
c := &stripe.BackendConfiguration{URL: stripe.APIURL}
c := &stripe.BackendConfiguration{Mutex: &sync.Mutex{}, URL: stripe.APIURL}
p := &stripe.Params{StripeAccount: TestMerchantID}

req, err := c.NewRequest("", "", "", "", nil, p)
Expand All @@ -72,7 +72,7 @@ func TestStripeAccount(t *testing.T) {
}

func TestUserAgent(t *testing.T) {
c := &stripe.BackendConfiguration{URL: stripe.APIURL}
c := &stripe.BackendConfiguration{Mutex: &sync.Mutex{}, URL: stripe.APIURL}

req, err := c.NewRequest("", "", "", "", nil, nil)
assert.NoError(t, err)
Expand All @@ -94,7 +94,7 @@ func TestUserAgentWithAppInfo(t *testing.T) {
stripe.SetAppInfo(appInfo)
defer stripe.SetAppInfo(nil)

c := &stripe.BackendConfiguration{URL: stripe.APIURL}
c := &stripe.BackendConfiguration{Mutex: &sync.Mutex{}, URL: stripe.APIURL}

req, err := c.NewRequest("", "", "", "", nil, nil)
assert.NoError(t, err)
Expand All @@ -108,7 +108,7 @@ func TestUserAgentWithAppInfo(t *testing.T) {
}

func TestStripeClientUserAgent(t *testing.T) {
c := &stripe.BackendConfiguration{URL: stripe.APIURL}
c := &stripe.BackendConfiguration{Mutex: &sync.Mutex{}, URL: stripe.APIURL}

req, err := c.NewRequest("", "", "", "", nil, nil)
assert.NoError(t, err)
Expand Down Expand Up @@ -142,7 +142,7 @@ func TestStripeClientUserAgentWithAppInfo(t *testing.T) {
stripe.SetAppInfo(appInfo)
defer stripe.SetAppInfo(nil)

c := &stripe.BackendConfiguration{URL: stripe.APIURL}
c := &stripe.BackendConfiguration{Mutex: &sync.Mutex{}, URL: stripe.APIURL}

req, err := c.NewRequest("", "", "", "", nil, nil)
assert.NoError(t, err)
Expand All @@ -161,7 +161,7 @@ func TestStripeClientUserAgentWithAppInfo(t *testing.T) {
}

func TestResponseToError(t *testing.T) {
c := &stripe.BackendConfiguration{URL: stripe.APIURL}
c := &stripe.BackendConfiguration{Mutex: &sync.Mutex{}, URL: stripe.APIURL}

// A test response that includes a status code and request ID.
res := &http.Response{
Expand Down
2 changes: 2 additions & 0 deletions testing/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"os"
"strconv"
"strings"
"sync"

stripe "github.com/stripe/stripe-go"
"github.com/stripe/stripe-go/form"
Expand Down Expand Up @@ -56,6 +57,7 @@ func init() {

stripe.Key = "sk_test_myTestKey"
stripe.SetBackend("api", stripe.BackendConfiguration{
Mutex: &sync.Mutex{},
Type: stripe.APIBackend,
URL: "http://localhost:" + port + "/v1",
HTTPClient: &http.Client{},
Expand Down

0 comments on commit 58e3196

Please sign in to comment.