github.com/segmentio/kafka-go@v0.4.48-0.20240318174348-3f6244eb34fd/protocol/alteruserscramcredentials/alteruserscramcredentials_test.go (about)

     1  package alteruserscramcredentials_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/segmentio/kafka-go/protocol/alteruserscramcredentials"
     7  	"github.com/segmentio/kafka-go/protocol/prototest"
     8  )
     9  
    10  const (
    11  	v0 = 0
    12  )
    13  
    14  func TestAlterUserScramCredentialsRequest(t *testing.T) {
    15  	prototest.TestRequest(t, v0, &alteruserscramcredentials.Request{
    16  		Deletions: []alteruserscramcredentials.RequestUserScramCredentialsDeletion{
    17  			{
    18  				Name:      "foo-1",
    19  				Mechanism: 1,
    20  			},
    21  		},
    22  		Upsertions: []alteruserscramcredentials.RequestUserScramCredentialsUpsertion{
    23  			{
    24  				Name:           "foo-2",
    25  				Mechanism:      2,
    26  				Iterations:     15000,
    27  				Salt:           []byte("my-salt"),
    28  				SaltedPassword: []byte("my-salted-password"),
    29  			},
    30  		},
    31  	})
    32  }
    33  
    34  func TestAlterUserScramCredentialsResponse(t *testing.T) {
    35  	prototest.TestResponse(t, v0, &alteruserscramcredentials.Response{
    36  		ThrottleTimeMs: 500,
    37  		Results: []alteruserscramcredentials.ResponseUserScramCredentials{
    38  			{
    39  				User:         "foo",
    40  				ErrorCode:    1,
    41  				ErrorMessage: "foo-error",
    42  			},
    43  		},
    44  	})
    45  }