github.com/projecteru2/core@v0.0.0-20240321043226-06bcc1c23f58/auth/simple/credential_test.go (about)

     1  package simple
     2  
     3  import (
     4  	"context"
     5  	"testing"
     6  
     7  	"github.com/stretchr/testify/assert"
     8  )
     9  
    10  func TestBasicCredential(t *testing.T) {
    11  	sc := NewBasicCredential("test", "password")
    12  	m, err := sc.GetRequestMetadata(context.Background(), "a.com", "b.com")
    13  	assert.NoError(t, err)
    14  	v, ok := m["test"]
    15  	assert.True(t, ok)
    16  	assert.Equal(t, v, "password")
    17  	assert.False(t, sc.RequireTransportSecurity())
    18  }