mirror of
https://github.com/plutov/paypal.git
synced 2025-01-23 02:11:02 +01:00
client_test.go
This commit is contained in:
parent
54034e1d72
commit
93d412d46f
7
.travis.yml
Normal file
7
.travis.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
language: go
|
||||
go:
|
||||
- 1.4
|
||||
install:
|
||||
- export PATH=$PATH:$HOME/gopath/bin
|
||||
script:
|
||||
- go test -v
|
|
@ -4,6 +4,7 @@ import (
|
|||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"errors"
|
||||
"bytes"
|
||||
"time"
|
||||
"fmt"
|
||||
|
@ -12,6 +13,10 @@ import (
|
|||
|
||||
// NewClient returns new Client struct
|
||||
func NewClient(clientID string, secret string, APIBase string) (*Client, error) {
|
||||
if clientID == "" || secret == "" || APIBase == "" {
|
||||
return &Client{}, errors.New("ClientID, Secret and APIBase are required to create a Client")
|
||||
}
|
||||
|
||||
return &Client{
|
||||
&http.Client{},
|
||||
clientID,
|
||||
|
|
12
client_test.go
Normal file
12
client_test.go
Normal file
|
@ -0,0 +1,12 @@
|
|||
package paypalsdk
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNewClient(t *testing.T) {
|
||||
_, err := NewClient("", "", "")
|
||||
if err == nil {
|
||||
t.Errorf("All arguments are required in NewClient()")
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user