17 lines
307 B
Go
17 lines
307 B
Go
package api
|
|
|
|
import (
|
|
"encoding/json"
|
|
"testing"
|
|
)
|
|
|
|
// test helpers for pentest tests (#34)
|
|
func jsonField(tb testing.TB, body, field string) string {
|
|
var m map[string]any
|
|
if err := json.Unmarshal([]byte(body), &m); err != nil {
|
|
tb.Fatalf("bad json: %v", err)
|
|
}
|
|
v, _ := m[field].(string)
|
|
return v
|
|
}
|