Skip to content

Commit

Permalink
agent: drop other tests for MethodNotAllowed
Browse files Browse the repository at this point in the history
  • Loading branch information
magiconair committed Aug 19, 2017
1 parent 04e6722 commit ea2facc
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 69 deletions.
1 change: 0 additions & 1 deletion agent/acl_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ func TestACL_Bootstrap(t *testing.T) {
code int
token bool
}{
// {"bad method", "GET", http.StatusMethodNotAllowed, false},
{"bootstrap", "PUT", http.StatusOK, true},
{"not again", "PUT", http.StatusForbidden, false},
}
Expand Down
33 changes: 0 additions & 33 deletions agent/prepared_query_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -737,39 +737,6 @@ func TestPreparedQuery_Delete(t *testing.T) {
}
}

func TestPreparedQuery_BadMethods(t *testing.T) {
t.Parallel()
t.Run("", func(t *testing.T) {
a := NewTestAgent(t.Name(), nil)
defer a.Shutdown()

body := bytes.NewBuffer(nil)
req, _ := http.NewRequest("DELETE", "/v1/query", body)
resp := httptest.NewRecorder()
if _, err := a.srv.PreparedQueryGeneral(resp, req); err != nil {
t.Fatalf("err: %v", err)
}
if resp.Code != 405 {
t.Fatalf("bad code: %d", resp.Code)
}
})

t.Run("", func(t *testing.T) {
a := NewTestAgent(t.Name(), nil)
defer a.Shutdown()

body := bytes.NewBuffer(nil)
req, _ := http.NewRequest("POST", "/v1/query/my-id", body)
resp := httptest.NewRecorder()
if _, err := a.srv.PreparedQuerySpecific(resp, req); err != nil {
t.Fatalf("err: %v", err)
}
if resp.Code != 405 {
t.Fatalf("bad code: %d", resp.Code)
}
})
}

func TestPreparedQuery_parseLimit(t *testing.T) {
t.Parallel()
body := bytes.NewBuffer(nil)
Expand Down
35 changes: 0 additions & 35 deletions agent/snapshot_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,38 +99,3 @@ func TestSnapshot_Options(t *testing.T) {
})
}
}

func TestSnapshot_BadMethods(t *testing.T) {
t.Parallel()
t.Run("", func(t *testing.T) {
a := NewTestAgent(t.Name(), nil)
defer a.Shutdown()

body := bytes.NewBuffer(nil)
req, _ := http.NewRequest("POST", "/v1/snapshot", body)
resp := httptest.NewRecorder()
_, err := a.srv.Snapshot(resp, req)
if err != nil {
t.Fatalf("err: %v", err)
}
if resp.Code != 405 {
t.Fatalf("bad code: %d", resp.Code)
}
})

t.Run("", func(t *testing.T) {
a := NewTestAgent(t.Name(), nil)
defer a.Shutdown()

body := bytes.NewBuffer(nil)
req, _ := http.NewRequest("DELETE", "/v1/snapshot", body)
resp := httptest.NewRecorder()
_, err := a.srv.Snapshot(resp, req)
if err != nil {
t.Fatalf("err: %v", err)
}
if resp.Code != 405 {
t.Fatalf("bad code: %d", resp.Code)
}
})
}

0 comments on commit ea2facc

Please sign in to comment.