1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
//go:build !functional
package sarama
import (
"testing"
"time"
)
var (
emptyAlterUserScramCredentialsResponse = []byte{
0, 0, 11, 184, // throttle time
1, // empty results array
0, // empty tagged fields
}
userAlterUserScramCredentialsResponse = []byte{
0, 0, 11, 184, // throttle time
2, // results array length
7, 'n', 'o', 'b', 'o', 'd', 'y', // User
0, 11, // ErrorCode
6, 'e', 'r', 'r', 'o', 'r', // ErrorMessage
0, // empty tagged fields
0, // empty tagged fields
}
)
func TestAlterUserScramCredentialsResponse(t *testing.T) {
response := &AlterUserScramCredentialsResponse{
Version: 0,
ThrottleTime: time.Second * 3,
}
testResponse(t, "empty response", response, emptyAlterUserScramCredentialsResponse)
resultErrorMessage := "error"
response.Results = append(response.Results, &AlterUserScramCredentialsResult{
User: "nobody",
ErrorCode: 11,
ErrorMessage: &resultErrorMessage,
})
testResponse(t, "single user response", response, userAlterUserScramCredentialsResponse)
}
|