wip integration bidding

This commit is contained in:
JBP
2019-08-16 21:28:25 +02:00
parent bc5c9ef1e3
commit 22c6e9d1bd
7 changed files with 251 additions and 81 deletions

View File

@@ -6,6 +6,7 @@ import (
"io/ioutil"
"net/http"
"net/http/httptest"
"net/url"
"testing"
"github.com/jybp/ebay"
@@ -24,7 +25,7 @@ func TestNewRequest(t *testing.T) {
func TestCheckResponseNoError(t *testing.T) {
resp := &http.Response{StatusCode: 200}
assert.Nil(t, ebay.CheckResponse(resp))
assert.Nil(t, ebay.CheckResponse(&http.Request{}, resp))
}
func TestCheckResponse(t *testing.T) {
@@ -53,7 +54,7 @@ func TestCheckResponse(t *testing.T) {
]
}`
resp := &http.Response{StatusCode: 400, Body: ioutil.NopCloser(bytes.NewBufferString(body))}
err, ok := ebay.CheckResponse(resp).(*ebay.ErrorData)
err, ok := ebay.CheckResponse(&http.Request{URL: &url.URL{}}, resp).(*ebay.ErrorData)
assert.True(t, ok)
assert.Equal(t, 1, len(err.Errors))
assert.Equal(t, 15008, err.Errors[0].ErrorID)