github.com/koko1123/flow-go-1@v0.29.6/utils/grpcutils/grpc_client_test.go (about)

     1  package grpcutils
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/require"
     7  
     8  	"github.com/koko1123/flow-go-1/utils/unittest"
     9  )
    10  
    11  func TestSecureGRPCDialOpt(t *testing.T) {
    12  	t.Run("should return valid secured GRPC dial option with no errors", func(t *testing.T) {
    13  		nk := unittest.NetworkingPrivKeyFixture()
    14  		_, err := SecureGRPCDialOpt(nk.PublicKey().String()[2:])
    15  		require.NoError(t, err)
    16  	})
    17  
    18  	t.Run("should return error when invalid public key argument used", func(t *testing.T) {
    19  		// un-encoded public key will cause hex decoding to fail
    20  		_, err := SecureGRPCDialOpt("")
    21  		require.Error(t, err)
    22  	})
    23  }