mirror of
https://github.com/plutov/paypal.git
synced 2025-01-23 10:21:03 +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"
|
"encoding/json"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"errors"
|
||||||
"bytes"
|
"bytes"
|
||||||
"time"
|
"time"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
@ -12,6 +13,10 @@ import (
|
||||||
|
|
||||||
// NewClient returns new Client struct
|
// NewClient returns new Client struct
|
||||||
func NewClient(clientID string, secret string, APIBase string) (*Client, error) {
|
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{
|
return &Client{
|
||||||
&http.Client{},
|
&http.Client{},
|
||||||
clientID,
|
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