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

Function TestJSONUnmarshalAuthenticationMD5Password

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

Source from the content-addressed store, hash-verified

8)
9
10func 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
25func TestJSONUnmarshalAuthenticationSASL(t *testing.T) {
26 data := []byte(`{"Type":"AuthenticationSASL","AuthMechanisms":["SCRAM-SHA-256"]}`)

Callers

nothing calls this directly

Calls 1

ErrorMethod · 0.45

Tested by

no test coverage detected