(t *testing.T)
| 350 | } |
| 351 | |
| 352 | func 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 | |
| 375 | func TestBadMethodRequest(t *testing.T) { |
| 376 | log.SetOutput(&bytes.Buffer{}) |
nothing calls this directly
no test coverage detected