github.com/prebid/prebid-server/v2@v2.18.0/adapters/triplelift_native/triplelift_native_test.go (about) 1 package triplelift_native 2 3 import ( 4 "testing" 5 6 "github.com/prebid/prebid-server/v2/adapters/adapterstest" 7 "github.com/prebid/prebid-server/v2/config" 8 "github.com/prebid/prebid-server/v2/openrtb_ext" 9 "github.com/stretchr/testify/assert" 10 ) 11 12 func TestBadConfig(t *testing.T) { 13 _, buildErr := Builder(openrtb_ext.BidderTripleliftNative, config.Adapter{ 14 Endpoint: `http://tlx.3lift.net/s2sn/auction?supplier_id=20`, 15 ExtraAdapterInfo: `{foo:2}`, 16 }, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) 17 18 assert.Error(t, buildErr) 19 } 20 21 func TestEmptyConfig(t *testing.T) { 22 bidder, buildErr := Builder(openrtb_ext.BidderTripleliftNative, config.Adapter{ 23 Endpoint: `http://tlx.3lift.net/s2sn/auction?supplier_id=20`, 24 ExtraAdapterInfo: ``, 25 }, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) 26 27 bidderTripleliftNative := bidder.(*TripleliftNativeAdapter) 28 29 assert.NoError(t, buildErr) 30 assert.Empty(t, bidderTripleliftNative.extInfo.PublisherWhitelist) 31 assert.Empty(t, bidderTripleliftNative.extInfo.PublisherWhitelistMap) 32 } 33 34 func TestJsonSamples(t *testing.T) { 35 bidder, buildErr := Builder(openrtb_ext.BidderTripleliftNative, config.Adapter{ 36 Endpoint: `http://tlx.3lift.net/s2sn/auction?supplier_id=20`, 37 ExtraAdapterInfo: `{"publisher_whitelist":["foo","bar","baz"]}`, 38 }, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) 39 40 if buildErr != nil { 41 t.Fatalf("Builder returned unexpected error %v", buildErr) 42 } 43 44 adapterstest.RunJSONBidderTest(t, "triplelift_nativetest", bidder) 45 }