| 8 | ) |
| 9 | |
| 10 | func TestJSONUnmarshalAuthenticationMD5Password(t *testing.T) { |
| 11 | data := []byte(`{"Type":"AuthenticationMD5Password", "Salt":[97,98,99,100]}`) |
| 12 | want := AuthenticationMD5Password{ |
| 13 | Salt: [4]byte{'a', 'b', 'c', 'd'}, |
| 14 | } |
| 15 | |
| 16 | var got AuthenticationMD5Password |
| 17 | if err := json.Unmarshal(data, &got); err != nil { |
| 18 | t.Errorf("cannot JSON unmarshal %v", err) |
| 19 | } |
| 20 | if !reflect.DeepEqual(got, want) { |
| 21 | t.Error("unmarshaled AuthenticationMD5Password struct doesn't match expected value") |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | func TestJSONUnmarshalAuthenticationSASL(t *testing.T) { |
| 26 | data := []byte(`{"Type":"AuthenticationSASL","AuthMechanisms":["SCRAM-SHA-256"]}`) |