mirror of
https://github.com/cubixle/ebay.git
synced 2026-04-30 14:58:44 +01:00
Add more GetBidding test and IsError
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package ebay_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
@@ -13,3 +15,17 @@ func TestOptBuyMarketplace(t *testing.T) {
|
||||
ebay.OptBuyMarketplace("EBAY_US")(r)
|
||||
assert.Equal(t, "EBAY_US", r.Header.Get("X-EBAY-C-MARKETPLACE-ID"))
|
||||
}
|
||||
|
||||
func TestGetBidding(t *testing.T) {
|
||||
client, mux, teardown := setup(t)
|
||||
defer teardown()
|
||||
|
||||
mux.HandleFunc("/buy/offer/v1_beta/bidding/v1|202117468662|0", func(w http.ResponseWriter, r *http.Request) {
|
||||
marketplaceID := r.Header.Get("X-EBAY-C-MARKETPLACE-ID")
|
||||
fmt.Fprintf(w, `{"itemId": "%s"}`, marketplaceID)
|
||||
})
|
||||
|
||||
bidding, err := client.Buy.Offer.GetBidding(context.Background(), "v1|202117468662|0", ebay.BuyMarketplaceUSA)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, ebay.BuyMarketplaceUSA, bidding.ItemID)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user