19 lines
610 B
Go
19 lines
610 B
Go
package httpapi
|
|
|
|
import (
|
|
"net/http/httptest"
|
|
"testing"
|
|
)
|
|
|
|
func TestPMAAuditKeepsSQLAndUnknownWrites(t *testing.T) {
|
|
for _, tc := range []struct {
|
|
method, route string
|
|
want bool
|
|
}{{"POST", "/config/get", false}, {"POST", "/config/set", false}, {"POST", "/navigation", false}, {"POST", "/sql", true}, {"POST", "/import", true}, {"POST", "/unrecognized", true}, {"POST", "", true}, {"GET", "/sql", false}} {
|
|
r := httptest.NewRequest(tc.method, "https://control.vhost.ser888.cn/?route="+tc.route, nil)
|
|
if pmaNeedsAudit(r) != tc.want {
|
|
t.Fatalf("audit %s %s", tc.method, tc.route)
|
|
}
|
|
}
|
|
}
|