github.com/newrelic/newrelic-client-go@v1.1.0/pkg/apm/apm_test.go (about)

     1  package apm
     2  
     3  import (
     4  	"net/http"
     5  	"net/http/httptest"
     6  	"testing"
     7  
     8  	mock "github.com/newrelic/newrelic-client-go/pkg/testhelpers"
     9  )
    10  
    11  // nolint
    12  func newTestClient(t *testing.T, handler http.Handler) APM {
    13  	ts := httptest.NewServer(handler)
    14  	tc := mock.NewTestConfig(t, ts)
    15  
    16  	c := New(tc)
    17  
    18  	return c
    19  }
    20  
    21  // nolint
    22  func newMockResponse(t *testing.T, mockJSONResponse string, statusCode int) APM {
    23  	ts := mock.NewMockServer(t, mockJSONResponse, statusCode)
    24  	tc := mock.NewTestConfig(t, ts)
    25  
    26  	return New(tc)
    27  }
    28  
    29  // nolint
    30  func newIntegrationTestClient(t *testing.T) APM {
    31  	cfg := mock.NewIntegrationTestConfig(t)
    32  	client := New(cfg)
    33  
    34  	return client
    35  }