github.com/prebid/prebid-server/v2@v2.18.0/adapters/bwx/bwx_test.go (about)

     1  package bwx
     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 TestJsonSamples(t *testing.T) {
    13  	bidder, buildErr := Builder(
    14  		openrtb_ext.BidderBWX,
    15  		config.Adapter{
    16  			Endpoint: "http://rtb.boldwin.live/?pid={{.SourceId}}&host={{.Host}}&pbs=1",
    17  		},
    18  		config.Server{
    19  			ExternalUrl: "http://hosturl.com",
    20  			GvlID:       1,
    21  			DataCenter:  "2",
    22  		},
    23  	)
    24  
    25  	assert.NoError(t, buildErr)
    26  	adapterstest.RunJSONBidderTest(t, "bwxtest", bidder)
    27  }
    28  
    29  func TestEndpointTemplateMalformed(t *testing.T) {
    30  	_, buildErr := Builder(openrtb_ext.BidderBWX, config.Adapter{
    31  		Endpoint: "{{Malformed}}"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"})
    32  
    33  	assert.Error(t, buildErr)
    34  }