| 8 | ) |
| 9 | |
| 10 | func TestSASLAuthenticateRequestV0(t *testing.T) { |
| 11 | item := saslAuthenticateRequestV0{ |
| 12 | Data: []byte("\x00user\x00pass"), |
| 13 | } |
| 14 | |
| 15 | b := bytes.NewBuffer(nil) |
| 16 | w := &writeBuffer{w: b} |
| 17 | item.writeTo(w) |
| 18 | |
| 19 | var found saslAuthenticateRequestV0 |
| 20 | remain, err := (&found).readFrom(bufio.NewReader(b), b.Len()) |
| 21 | if err != nil { |
| 22 | t.Error(err) |
| 23 | t.FailNow() |
| 24 | } |
| 25 | if remain != 0 { |
| 26 | t.Errorf("expected 0 remain, got %v", remain) |
| 27 | t.FailNow() |
| 28 | } |
| 29 | if !reflect.DeepEqual(item, found) { |
| 30 | t.Error("expected item and found to be the same") |
| 31 | t.FailNow() |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | func TestSASLAuthenticateResponseV0(t *testing.T) { |
| 36 | item := saslAuthenticateResponseV0{ |