restore missed delete

This commit is contained in:
Umputun
2018-01-10 03:20:14 -06:00
parent 26b528664b
commit 3922ee968a
2 changed files with 5 additions and 3 deletions
+1
View File
@@ -91,6 +91,7 @@ func (s *Server) Run(port int) {
rapi.With(auth.Auth(s.SessionStore, s.Admins, maybeDevMode(auth.Full))).Group(func(rauth chi.Router) {
rauth.Post("/comment", s.createCommentCtrl)
rauth.Put("/comment/{id}", s.updateCommentCtrl)
rauth.Delete("/comment/{id}", s.deleteCommentCtrl)
rauth.Get("/user", s.userInfoCtrl)
rauth.Put("/vote/{id}", s.voteCtrl)
+4 -3
View File
@@ -231,13 +231,14 @@ func TestServer_Delete(t *testing.T) {
client := http.Client{}
req, err := http.NewRequest(http.MethodDelete,
fmt.Sprintf("http://127.0.0.1:%d/api/v1/comment/%s?site=radio-t&url=https://radio-t.com/blah1", port, id1),
fmt.Sprintf("http://127.0.0.1:%d/api/v1/comment/%s?site=radio-t&url=https://radio-t.com/blah", port, id1),
nil)
assert.Nil(t, err)
_, err = client.Do(req)
resp, err := client.Do(req)
assert.Nil(t, err)
assert.Equal(t, 200, resp.StatusCode)
_, code := get(t, fmt.Sprintf("http://127.0.0.1:%d/api/v1/id/%s?site=radio-t&url=https://radio-t.com/blah1", port, id1))
_, code := get(t, fmt.Sprintf("http://127.0.0.1:%d/api/v1/id/%s?site=radio-t&url=https://radio-t.com/blah", port, id1))
assert.Equal(t, 400, code)
}