sasl_handshake_response_test.go 598 B

123456789101112131415161718192021222324
  1. package sarama
  2. import "testing"
  3. var (
  4. saslHandshakeResponse = []byte{
  5. 0x00, 0x00,
  6. 0x00, 0x00, 0x00, 0x01,
  7. 0x00, 0x03, 'f', 'o', 'o',
  8. }
  9. )
  10. func TestSaslHandshakeResponse(t *testing.T) {
  11. var response *SaslHandshakeResponse
  12. response = new(SaslHandshakeResponse)
  13. testVersionDecodable(t, "no error", response, saslHandshakeResponse, 0)
  14. if response.Err != ErrNoError {
  15. t.Error("Decoding error failed: no error expected but found", response.Err)
  16. }
  17. if response.EnabledMechanisms[0] != "foo" {
  18. t.Error("Decoding error failed: expected 'foo' but found", response.EnabledMechanisms)
  19. }
  20. }