MCPcopy Index your code
hub / github.com/assafmo/SQLiteQueryServer / TestBadMethodRequest

Function TestBadMethodRequest

main_test.go:375–394  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

373}
374
375func TestBadMethodRequest(t *testing.T) {
376 log.SetOutput(&bytes.Buffer{})
377
378 req := httptest.NewRequest("PUT",
379 "http://example.org/query",
380 nil)
381 w := httptest.NewRecorder()
382 queryHandler, err := initQueryHandler(testDbPath, "SELECT * FROM ip_dns WHERE dns = ?", 0)
383 if err != nil {
384 t.Fatal(err)
385 }
386 queryHandler(w, req)
387
388 resp := w.Result()
389 defer resp.Body.Close()
390
391 if resp.StatusCode != http.StatusMethodNotAllowed {
392 t.Fatalf(`resp.StatusCode (%d) != http.StatusMethodNotAllowed (%d)`, resp.StatusCode, http.StatusMethodNotAllowed)
393 }
394}
395
396type errReader int
397

Callers

nothing calls this directly

Calls 1

initQueryHandlerFunction · 0.85

Tested by

no test coverage detected