sasl_handshake_response_test.go 561 B

12345678910111213141516171819202122
  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. response := new(SaslHandshakeResponse)
  12. testVersionDecodable(t, "no error", response, saslHandshakeResponse, 0)
  13. if response.Err != ErrNoError {
  14. t.Error("Decoding error failed: no error expected but found", response.Err)
  15. }
  16. if response.EnabledMechanisms[0] != "foo" {
  17. t.Error("Decoding error failed: expected 'foo' but found", response.EnabledMechanisms)
  18. }
  19. }