| 23 | } |
| 24 | |
| 25 | func TestJSONUnmarshalAuthenticationSASL(t *testing.T) { |
| 26 | data := []byte(`{"Type":"AuthenticationSASL","AuthMechanisms":["SCRAM-SHA-256"]}`) |
| 27 | want := AuthenticationSASL{ |
| 28 | []string{"SCRAM-SHA-256"}, |
| 29 | } |
| 30 | |
| 31 | var got AuthenticationSASL |
| 32 | if err := json.Unmarshal(data, &got); err != nil { |
| 33 | t.Errorf("cannot JSON unmarshal %v", err) |
| 34 | } |
| 35 | if !reflect.DeepEqual(got, want) { |
| 36 | t.Error("unmarshaled AuthenticationSASL struct doesn't match expected value") |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | func TestJSONUnmarshalAuthenticationGSS(t *testing.T) { |
| 41 | data := []byte(`{"Type":"AuthenticationGSS"}`) |