backend-ci.yml's `test -z "$(gofmt -l .)"` strict gate (added in
13c21ac11) failed on a backlog of unformatted files. None of the
85 files in this commit had been edited since the gate was added
because no push touched veza-backend-api/** in between, so the
gate never fired until today's CI fixes triggered it.
The diff is exclusively whitespace alignment in struct literals
and trailing-space comments. `go build ./...` and the full test
suite (with VEZA_SKIP_INTEGRATION=1 -short) pass identically.
27 lines
762 B
Go
27 lines
762 B
Go
package handlers
|
|
|
|
import (
|
|
"encoding/json"
|
|
"testing"
|
|
)
|
|
|
|
// FuzzLoginPayload fuzzes the login request parsing.
|
|
// The handler should never panic on any input.
|
|
func FuzzLoginPayload(f *testing.F) {
|
|
f.Add([]byte(`{"email":"test@test.com","password":"Pass123!"}`))
|
|
f.Add([]byte(`{"email":"","password":""}`))
|
|
f.Add([]byte(`{}`))
|
|
f.Add([]byte(`invalid json`))
|
|
f.Add([]byte(""))
|
|
f.Add([]byte(`{"email":null,"password":123}`))
|
|
f.Add([]byte(`{"email":"a@b.c","password":"` + string(make([]byte, 10000)) + `"}`))
|
|
|
|
f.Fuzz(func(t *testing.T, data []byte) {
|
|
// Verify that JSON parsing of arbitrary payloads never panics
|
|
var payload struct {
|
|
Email string `json:"email"`
|
|
Password string `json:"password"`
|
|
}
|
|
_ = json.Unmarshal(data, &payload)
|
|
})
|
|
}
|