github.com/prebid/prebid-server@v0.275.0/adapters/consumable/consumable_test.go (about) 1 package consumable 2 3 import ( 4 "testing" 5 "time" 6 7 "github.com/prebid/prebid-server/adapters" 8 "github.com/prebid/prebid-server/adapters/adapterstest" 9 "github.com/prebid/prebid-server/config" 10 "github.com/prebid/prebid-server/openrtb_ext" 11 "github.com/stretchr/testify/assert" 12 ) 13 14 func TestJsonSamples(t *testing.T) { 15 bidder, buildErr := Builder(openrtb_ext.BidderConsumable, config.Adapter{ 16 Endpoint: "http://ib.adnxs.com/openrtb2"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) 17 18 if buildErr != nil { 19 t.Fatalf("Builder returned unexpected error %v", buildErr) 20 } 21 22 assertClock(t, bidder) 23 replaceClockWithKnownTime(bidder) 24 25 adapterstest.RunJSONBidderTest(t, "consumable", bidder) 26 } 27 28 func assertClock(t *testing.T, bidder adapters.Bidder) { 29 bidderConsumable, _ := bidder.(*ConsumableAdapter) 30 assert.NotNil(t, bidderConsumable.clock) 31 } 32 33 func replaceClockWithKnownTime(bidder adapters.Bidder) { 34 bidderConsumable, _ := bidder.(*ConsumableAdapter) 35 bidderConsumable.clock = knownInstant(time.Date(2016, 1, 1, 12, 30, 15, 0, time.UTC)) 36 }