diff --git a/.travis.yml b/.travis.yml index 1b4ade0..b87eb9d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: go go: - - 1.4 + - 1.5 install: - export PATH=$PATH:$HOME/gopath/bin script: diff --git a/auth_test.go b/auth_test.go index 4e3191d..8b58e6f 100644 --- a/auth_test.go +++ b/auth_test.go @@ -18,10 +18,14 @@ func TestGetAuthorization(t *testing.T) { c.GetAccessToken() a, err := c.GetAuthorization(testAuthID) - if err != nil || a.ID != testAuthID { t.Errorf("GetAuthorization failed for ID=" + testAuthID) } + + a, err = c.GetAuthorization(testFakeAuthID) + if err == nil { + t.Errorf("GetAuthorization must return error for ID=" + testFakeAuthID) + } } func TestCaptureAuthorization(t *testing.T) { diff --git a/client_test.go b/client_test.go index 309feda..44e1e20 100644 --- a/client_test.go +++ b/client_test.go @@ -1,6 +1,7 @@ package paypalsdk import ( + "fmt" "testing" ) @@ -8,7 +9,9 @@ import ( var testClientID = "AZgwu4yt5Ba0gyTu1dGBH3txHCJbMuFNvrmQxBaQbfDncDiCs6W_rwJD8Ir-0pZrN-_eq7n9zVd8Y-5f" var testSecret = "EBzA1wRl5t73OMugOieDj_tI3vihfJmGl47ukQT-cpctooIzDu0K7IPESNC0cKodlLSOXzwI8qXSM0rd" var testAuthID = "2DC87612EK520411B" +var testFakeAuthID = "FAKE-2DC87612EK520411B" var testOrderID = "O-4J082351X3132253H" +var testFakeOrderID = "FAKE-O-4J082351X3132253H" var testSaleID = "4CF18861HF410323U" var testPaymentID = "PAY-5YK922393D847794YKER7MUI" var testPayerID = "CR87QHB7JTRSC" @@ -17,6 +20,8 @@ func TestNewClient(t *testing.T) { _, err := NewClient("", "", "") if err == nil { t.Errorf("All arguments are required in NewClient()") + } else { + fmt.Println(err.Error()) } _, err = NewClient(testClientID, testSecret, APIBaseSandBox) diff --git a/order_test.go b/order_test.go index 0637710..14e9870 100644 --- a/order_test.go +++ b/order_test.go @@ -10,10 +10,14 @@ func TestGetOrder(t *testing.T) { c.GetAccessToken() o, err := c.GetOrder(testOrderID) - if err != nil || o.ID != testOrderID { t.Errorf("GetOrder failed for ID=" + testOrderID) } + + o, err = c.GetOrder(testFakeOrderID) + if err == nil { + t.Errorf("GetOrder must return error for ID=" + testFakeOrderID) + } } func TestAuthorizeOrder(t *testing.T) {