github.com/hamba/avro@v1.8.0/registry/client_internal_test.go (about)

     1  package registry
     2  
     3  import (
     4  	"net/http"
     5  	"testing"
     6  
     7  	"github.com/stretchr/testify/assert"
     8  )
     9  
    10  func TestNewClient_WithHTTPClient(t *testing.T) {
    11  	httpClient := &http.Client{}
    12  
    13  	client, _ := NewClient("http://example.com", WithHTTPClient(httpClient))
    14  
    15  	assert.Equal(t, client.client, httpClient)
    16  }
    17  
    18  func TestNewClient_WithBasicAuth(t *testing.T) {
    19  	creds := credentials{username: "username", password: "password"}
    20  
    21  	client, _ := NewClient("http://example.com", WithBasicAuth("username", "password"))
    22  
    23  	assert.Equal(t, client.creds, creds)
    24  }