auth
auth/http.go
Move HTTP tests to http_test.go, rename the GetGrant test. Rename the GetGrant test to something that makes it more obvious, and indicate that we're only testing for successful responses in this function (e.g., responses that should be successfully handled). Another function will deal with failure modes. Move the function to a new http_test.go file. The model files are shouldn't have information about how the models are being represented.
1 package auth
3 import (
4 "log"
5 "net/http"
6 )
8 const getGrantTemplateName = "get_grant"
10 func GetGrantHandler(w http.ResponseWriter, r *http.Request, context Context) {
11 w.WriteHeader(http.StatusOK)
12 err := context.Render(w, getGrantTemplateName, nil)
13 if err != nil {
14 log.Println("Error rendering template for GetGrantHandler:", err)
15 }
16 }