github.com/prebid/prebid-server/v2@v2.18.0/adapters/onetag/onetag_test.go (about)

     1  package onetag
     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 TestEndpointTemplateMalformed(t *testing.T) {
    13  	_, buildErr := Builder(openrtb_ext.BidderOneTag, config.Adapter{
    14  		Endpoint: "{{Malformed}}"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"})
    15  
    16  	assert.Error(t, buildErr)
    17  }
    18  
    19  func TestJsonSamples(t *testing.T) {
    20  	bidder, buildErr := Builder(openrtb_ext.BidderOneTag, config.Adapter{
    21  		Endpoint: "https://example.com/prebid-server/{{.PublisherID}}"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"})
    22  
    23  	assert.NoError(t, buildErr, "Builder returned unexpected error %v", buildErr)
    24  
    25  	adapterstest.RunJSONBidderTest(t, "onetagtest", bidder)
    26  }