MCPcopy Create free account
hub / github.com/PostHog/duckgres / TestWriteAuthOK

Function TestWriteAuthOK

server/protocol_test.go:234–258  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

232}
233
234func TestWriteAuthOK(t *testing.T) {
235 var buf bytes.Buffer
236
237 err := wire.WriteAuthOK(&buf)
238 if err != nil {
239 t.Fatalf("wire.WriteAuthOK() error = %v", err)
240 }
241
242 // Message type should be 'R'
243 if buf.Bytes()[0] != 'R' {
244 t.Errorf("message type = %c, want R", buf.Bytes()[0])
245 }
246
247 // Length should be 8 (4 for length + 4 for auth type)
248 length := binary.BigEndian.Uint32(buf.Bytes()[1:5])
249 if length != 8 {
250 t.Errorf("length = %d, want 8", length)
251 }
252
253 // Auth type should be 0 (OK)
254 authType := binary.BigEndian.Uint32(buf.Bytes()[5:9])
255 if authType != 0 {
256 t.Errorf("auth type = %d, want 0", authType)
257 }
258}
259
260func TestWriteAuthCleartextPassword(t *testing.T) {
261 var buf bytes.Buffer

Callers

nothing calls this directly

Calls 1

WriteAuthOKFunction · 0.92

Tested by

no test coverage detected