MCPcopy
hub / github.com/jackc/pgx / TestJSONUnmarshalAuthenticationSASL

Function TestJSONUnmarshalAuthenticationSASL

pgproto3/json_test.go:25–38  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

23}
24
25func 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
40func TestJSONUnmarshalAuthenticationGSS(t *testing.T) {
41 data := []byte(`{"Type":"AuthenticationGSS"}`)

Callers

nothing calls this directly

Calls 1

ErrorMethod · 0.45

Tested by

no test coverage detected