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

Function TestBadPathRequest

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

Source from the content-addressed store, hash-verified

350}
351
352func TestBadPathRequest(t *testing.T) {
353 log.SetOutput(&bytes.Buffer{})
354
355 reqString := `github.com`
356
357 req := httptest.NewRequest("POST",
358 "http://example.org/queri",
359 strings.NewReader(reqString))
360 w := httptest.NewRecorder()
361 queryHandler, err := initQueryHandler(testDbPath, "SELECT * FROM ip_dns WHERE dns = ?", 0)
362 if err != nil {
363 t.Fatal(err)
364 }
365 queryHandler(w, req)
366
367 resp := w.Result()
368 defer resp.Body.Close()
369
370 if resp.StatusCode != http.StatusNotFound {
371 t.Fatalf(`resp.StatusCode (%d) != http.StatusNotFound (%d)`, resp.StatusCode, http.StatusNotFound)
372 }
373}
374
375func TestBadMethodRequest(t *testing.T) {
376 log.SetOutput(&bytes.Buffer{})

Callers

nothing calls this directly

Calls 1

initQueryHandlerFunction · 0.85

Tested by

no test coverage detected