7179: handler_test.go is now lint free according to golint.
authorradhika <radhika@curoverse.com>
Sat, 12 Sep 2015 14:06:23 +0000 (10:06 -0400)
committerradhika <radhika@curoverse.com>
Sat, 12 Sep 2015 14:06:23 +0000 (10:06 -0400)
services/keepstore/handler_test.go

index a9bf91e842f7178fff900e40fb0c2b75fa4e9fba..68e80c410c0ba37a7a7f72c327e90cd53d4ddb62 100644 (file)
@@ -25,10 +25,10 @@ import (
 // A RequestTester represents the parameters for an HTTP request to
 // be issued on behalf of a unit test.
 type RequestTester struct {
-       uri          string
-       api_token    string
-       method       string
-       request_body []byte
+       uri         string
+       apiToken    string
+       method      string
+       requestBody []byte
 }
 
 // Test GetBlockHandler on the following situations:
@@ -57,11 +57,11 @@ func TestGetHandler(t *testing.T) {
        blob_signature_ttl = 300 * time.Second
 
        var (
-               unsigned_locator  = "/" + TEST_HASH
-               valid_timestamp   = time.Now().Add(blob_signature_ttl)
-               expired_timestamp = time.Now().Add(-time.Hour)
-               signed_locator    = "/" + SignLocator(TEST_HASH, known_token, valid_timestamp)
-               expired_locator   = "/" + SignLocator(TEST_HASH, known_token, expired_timestamp)
+               unsignedLocator  = "/" + TEST_HASH
+               validTimestamp   = time.Now().Add(blob_signature_ttl)
+               expiredTimestamp = time.Now().Add(-time.Hour)
+               signedLocator    = "/" + SignLocator(TEST_HASH, known_token, validTimestamp)
+               expiredLocator   = "/" + SignLocator(TEST_HASH, known_token, expiredTimestamp)
        )
 
        // -----------------
@@ -73,7 +73,7 @@ func TestGetHandler(t *testing.T) {
        response := IssueRequest(
                &RequestTester{
                        method: "GET",
-                       uri:    unsigned_locator,
+                       uri:    unsignedLocator,
                })
        ExpectStatusCode(t,
                "Unauthenticated request, unsigned locator", http.StatusOK, response)
@@ -82,10 +82,10 @@ func TestGetHandler(t *testing.T) {
                string(TEST_BLOCK),
                response)
 
-       received_cl := response.Header().Get("Content-Length")
-       expected_cl := fmt.Sprintf("%d", len(TEST_BLOCK))
-       if received_cl != expected_cl {
-               t.Errorf("expected Content-Length %s, got %s", expected_cl, received_cl)
+       receivedLen := response.Header().Get("Content-Length")
+       expectedLen := fmt.Sprintf("%d", len(TEST_BLOCK))
+       if receivedLen != expectedLen {
+               t.Errorf("expected Content-Length %s, got %s", expectedLen, receivedLen)
        }
 
        // ----------------
@@ -95,27 +95,27 @@ func TestGetHandler(t *testing.T) {
        // Authenticated request, signed locator
        // => OK
        response = IssueRequest(&RequestTester{
-               method:    "GET",
-               uri:       signed_locator,
-               api_token: known_token,
+               method:   "GET",
+               uri:      signedLocator,
+               apiToken: known_token,
        })
        ExpectStatusCode(t,
                "Authenticated request, signed locator", http.StatusOK, response)
        ExpectBody(t,
                "Authenticated request, signed locator", string(TEST_BLOCK), response)
 
-       received_cl = response.Header().Get("Content-Length")
-       expected_cl = fmt.Sprintf("%d", len(TEST_BLOCK))
-       if received_cl != expected_cl {
-               t.Errorf("expected Content-Length %s, got %s", expected_cl, received_cl)
+       receivedLen = response.Header().Get("Content-Length")
+       expectedLen = fmt.Sprintf("%d", len(TEST_BLOCK))
+       if receivedLen != expectedLen {
+               t.Errorf("expected Content-Length %s, got %s", expectedLen, receivedLen)
        }
 
        // Authenticated request, unsigned locator
        // => PermissionError
        response = IssueRequest(&RequestTester{
-               method:    "GET",
-               uri:       unsigned_locator,
-               api_token: known_token,
+               method:   "GET",
+               uri:      unsignedLocator,
+               apiToken: known_token,
        })
        ExpectStatusCode(t, "unsigned locator", PermissionError.HTTPCode, response)
 
@@ -123,7 +123,7 @@ func TestGetHandler(t *testing.T) {
        // => PermissionError
        response = IssueRequest(&RequestTester{
                method: "GET",
-               uri:    signed_locator,
+               uri:    signedLocator,
        })
        ExpectStatusCode(t,
                "Unauthenticated request, signed locator",
@@ -132,9 +132,9 @@ func TestGetHandler(t *testing.T) {
        // Authenticated request, expired locator
        // => ExpiredError
        response = IssueRequest(&RequestTester{
-               method:    "GET",
-               uri:       expired_locator,
-               api_token: known_token,
+               method:   "GET",
+               uri:      expiredLocator,
+               apiToken: known_token,
        })
        ExpectStatusCode(t,
                "Authenticated request, expired locator",
@@ -158,12 +158,12 @@ func TestPutHandler(t *testing.T) {
 
        // Unauthenticated request, no server key
        // => OK (unsigned response)
-       unsigned_locator := "/" + TEST_HASH
+       unsignedLocator := "/" + TEST_HASH
        response := IssueRequest(
                &RequestTester{
-                       method:       "PUT",
-                       uri:          unsigned_locator,
-                       request_body: TEST_BLOCK,
+                       method:      "PUT",
+                       uri:         unsignedLocator,
+                       requestBody: TEST_BLOCK,
                })
 
        ExpectStatusCode(t,
@@ -185,29 +185,29 @@ func TestPutHandler(t *testing.T) {
        // => OK (signed response)
        response = IssueRequest(
                &RequestTester{
-                       method:       "PUT",
-                       uri:          unsigned_locator,
-                       request_body: TEST_BLOCK,
-                       api_token:    known_token,
+                       method:      "PUT",
+                       uri:         unsignedLocator,
+                       requestBody: TEST_BLOCK,
+                       apiToken:    known_token,
                })
 
        ExpectStatusCode(t,
                "Authenticated PUT, signed locator, with server key",
                http.StatusOK, response)
-       response_locator := strings.TrimSpace(response.Body.String())
-       if VerifySignature(response_locator, known_token) != nil {
+       responseLocator := strings.TrimSpace(response.Body.String())
+       if VerifySignature(responseLocator, known_token) != nil {
                t.Errorf("Authenticated PUT, signed locator, with server key:\n"+
                        "response '%s' does not contain a valid signature",
-                       response_locator)
+                       responseLocator)
        }
 
        // Unauthenticated PUT, unsigned locator
        // => OK
        response = IssueRequest(
                &RequestTester{
-                       method:       "PUT",
-                       uri:          unsigned_locator,
-                       request_body: TEST_BLOCK,
+                       method:      "PUT",
+                       uri:         unsignedLocator,
+                       requestBody: TEST_BLOCK,
                })
 
        ExpectStatusCode(t,
@@ -227,9 +227,9 @@ func TestPutAndDeleteSkipReadonlyVolumes(t *testing.T) {
        defer KeepVM.Close()
        IssueRequest(
                &RequestTester{
-                       method:       "PUT",
-                       uri:          "/" + TEST_HASH,
-                       request_body: TEST_BLOCK,
+                       method:      "PUT",
+                       uri:         "/" + TEST_HASH,
+                       requestBody: TEST_BLOCK,
                })
        defer func(orig bool) {
                never_delete = orig
@@ -237,10 +237,10 @@ func TestPutAndDeleteSkipReadonlyVolumes(t *testing.T) {
        never_delete = false
        IssueRequest(
                &RequestTester{
-                       method:       "DELETE",
-                       uri:          "/" + TEST_HASH,
-                       request_body: TEST_BLOCK,
-                       api_token:    data_manager_token,
+                       method:      "DELETE",
+                       uri:         "/" + TEST_HASH,
+                       requestBody: TEST_BLOCK,
+                       apiToken:    data_manager_token,
                })
        type expect struct {
                volnum    int
@@ -293,33 +293,33 @@ func TestIndexHandler(t *testing.T) {
 
        data_manager_token = "DATA MANAGER TOKEN"
 
-       unauthenticated_req := &RequestTester{
+       unauthenticatedReq := &RequestTester{
                method: "GET",
                uri:    "/index",
        }
-       authenticated_req := &RequestTester{
-               method:    "GET",
-               uri:       "/index",
-               api_token: known_token,
+       authenticatedReq := &RequestTester{
+               method:   "GET",
+               uri:      "/index",
+               apiToken: known_token,
        }
-       superuser_req := &RequestTester{
-               method:    "GET",
-               uri:       "/index",
-               api_token: data_manager_token,
+       superuserReq := &RequestTester{
+               method:   "GET",
+               uri:      "/index",
+               apiToken: data_manager_token,
        }
-       unauth_prefix_req := &RequestTester{
+       unauthPrefixReq := &RequestTester{
                method: "GET",
                uri:    "/index/" + TEST_HASH[0:3],
        }
-       auth_prefix_req := &RequestTester{
-               method:    "GET",
-               uri:       "/index/" + TEST_HASH[0:3],
-               api_token: known_token,
+       authPrefixReq := &RequestTester{
+               method:   "GET",
+               uri:      "/index/" + TEST_HASH[0:3],
+               apiToken: known_token,
        }
-       superuser_prefix_req := &RequestTester{
-               method:    "GET",
-               uri:       "/index/" + TEST_HASH[0:3],
-               api_token: data_manager_token,
+       superuserPrefixReq := &RequestTester{
+               method:   "GET",
+               uri:      "/index/" + TEST_HASH[0:3],
+               apiToken: data_manager_token,
        }
 
        // -------------------------------------------------------------
@@ -332,7 +332,7 @@ func TestIndexHandler(t *testing.T) {
 
        // unauthenticated /index request
        // => UnauthorizedError
-       response := IssueRequest(unauthenticated_req)
+       response := IssueRequest(unauthenticatedReq)
        ExpectStatusCode(t,
                "enforce_permissions on, unauthenticated request",
                UnauthorizedError.HTTPCode,
@@ -340,7 +340,7 @@ func TestIndexHandler(t *testing.T) {
 
        // unauthenticated /index/prefix request
        // => UnauthorizedError
-       response = IssueRequest(unauth_prefix_req)
+       response = IssueRequest(unauthPrefixReq)
        ExpectStatusCode(t,
                "permissions on, unauthenticated /index/prefix request",
                UnauthorizedError.HTTPCode,
@@ -348,7 +348,7 @@ func TestIndexHandler(t *testing.T) {
 
        // authenticated /index request, non-superuser
        // => UnauthorizedError
-       response = IssueRequest(authenticated_req)
+       response = IssueRequest(authenticatedReq)
        ExpectStatusCode(t,
                "permissions on, authenticated request, non-superuser",
                UnauthorizedError.HTTPCode,
@@ -356,7 +356,7 @@ func TestIndexHandler(t *testing.T) {
 
        // authenticated /index/prefix request, non-superuser
        // => UnauthorizedError
-       response = IssueRequest(auth_prefix_req)
+       response = IssueRequest(authPrefixReq)
        ExpectStatusCode(t,
                "permissions on, authenticated /index/prefix request, non-superuser",
                UnauthorizedError.HTTPCode,
@@ -364,7 +364,7 @@ func TestIndexHandler(t *testing.T) {
 
        // superuser /index request
        // => OK
-       response = IssueRequest(superuser_req)
+       response = IssueRequest(superuserReq)
        ExpectStatusCode(t,
                "permissions on, superuser request",
                http.StatusOK,
@@ -377,7 +377,7 @@ func TestIndexHandler(t *testing.T) {
 
        // superuser /index request
        // => OK
-       response = IssueRequest(superuser_req)
+       response = IssueRequest(superuserReq)
        ExpectStatusCode(t,
                "permissions on, superuser request",
                http.StatusOK,
@@ -394,7 +394,7 @@ func TestIndexHandler(t *testing.T) {
 
        // superuser /index/prefix request
        // => OK
-       response = IssueRequest(superuser_prefix_req)
+       response = IssueRequest(superuserPrefixReq)
        ExpectStatusCode(t,
                "permissions on, superuser request",
                http.StatusOK,
@@ -452,44 +452,44 @@ func TestDeleteHandler(t *testing.T) {
        // even though they have just been created.
        blob_signature_ttl = time.Duration(0)
 
-       var user_token = "NOT DATA MANAGER TOKEN"
+       var userToken = "NOT DATA MANAGER TOKEN"
        data_manager_token = "DATA MANAGER TOKEN"
 
        never_delete = false
 
-       unauth_req := &RequestTester{
+       unauthReq := &RequestTester{
                method: "DELETE",
                uri:    "/" + TEST_HASH,
        }
 
-       user_req := &RequestTester{
-               method:    "DELETE",
-               uri:       "/" + TEST_HASH,
-               api_token: user_token,
+       userReq := &RequestTester{
+               method:   "DELETE",
+               uri:      "/" + TEST_HASH,
+               apiToken: userToken,
        }
 
-       superuser_existing_block_req := &RequestTester{
-               method:    "DELETE",
-               uri:       "/" + TEST_HASH,
-               api_token: data_manager_token,
+       superuserExistingBlockReq := &RequestTester{
+               method:   "DELETE",
+               uri:      "/" + TEST_HASH,
+               apiToken: data_manager_token,
        }
 
-       superuser_nonexistent_block_req := &RequestTester{
-               method:    "DELETE",
-               uri:       "/" + TEST_HASH_2,
-               api_token: data_manager_token,
+       superuserNonexistentBlockReq := &RequestTester{
+               method:   "DELETE",
+               uri:      "/" + TEST_HASH_2,
+               apiToken: data_manager_token,
        }
 
        // Unauthenticated request returns PermissionError.
        var response *httptest.ResponseRecorder
-       response = IssueRequest(unauth_req)
+       response = IssueRequest(unauthReq)
        ExpectStatusCode(t,
                "unauthenticated request",
                PermissionError.HTTPCode,
                response)
 
        // Authenticated non-admin request returns PermissionError.
-       response = IssueRequest(user_req)
+       response = IssueRequest(userReq)
        ExpectStatusCode(t,
                "authenticated non-admin request",
                PermissionError.HTTPCode,
@@ -500,9 +500,9 @@ func TestDeleteHandler(t *testing.T) {
                Deleted int `json:"copies_deleted"`
                Failed  int `json:"copies_failed"`
        }
-       var response_dc, expected_dc deletecounter
+       var responseDc, expectedDc deletecounter
 
-       response = IssueRequest(superuser_nonexistent_block_req)
+       response = IssueRequest(superuserNonexistentBlockReq)
        ExpectStatusCode(t,
                "data manager request, nonexistent block",
                http.StatusNotFound,
@@ -510,7 +510,7 @@ func TestDeleteHandler(t *testing.T) {
 
        // Authenticated admin request for existing block while never_delete is set.
        never_delete = true
-       response = IssueRequest(superuser_existing_block_req)
+       response = IssueRequest(superuserExistingBlockReq)
        ExpectStatusCode(t,
                "authenticated request, existing block, method disabled",
                MethodDisabledError.HTTPCode,
@@ -518,23 +518,23 @@ func TestDeleteHandler(t *testing.T) {
        never_delete = false
 
        // Authenticated admin request for existing block.
-       response = IssueRequest(superuser_existing_block_req)
+       response = IssueRequest(superuserExistingBlockReq)
        ExpectStatusCode(t,
                "data manager request, existing block",
                http.StatusOK,
                response)
        // Expect response {"copies_deleted":1,"copies_failed":0}
-       expected_dc = deletecounter{1, 0}
-       json.NewDecoder(response.Body).Decode(&response_dc)
-       if response_dc != expected_dc {
-               t.Errorf("superuser_existing_block_req\nexpected: %+v\nreceived: %+v",
-                       expected_dc, response_dc)
+       expectedDc = deletecounter{1, 0}
+       json.NewDecoder(response.Body).Decode(&responseDc)
+       if responseDc != expectedDc {
+               t.Errorf("superuserExistingBlockReq\nexpected: %+v\nreceived: %+v",
+                       expectedDc, responseDc)
        }
        // Confirm the block has been deleted
        _, err := vols[0].Get(TEST_HASH)
-       var block_deleted = os.IsNotExist(err)
-       if !block_deleted {
-               t.Error("superuser_existing_block_req: block not deleted")
+       var blockDeleted = os.IsNotExist(err)
+       if !blockDeleted {
+               t.Error("superuserExistingBlockReq: block not deleted")
        }
 
        // A DELETE request on a block newer than blob_signature_ttl
@@ -542,17 +542,17 @@ func TestDeleteHandler(t *testing.T) {
        vols[0].Put(TEST_HASH, TEST_BLOCK)
        blob_signature_ttl = time.Hour
 
-       response = IssueRequest(superuser_existing_block_req)
+       response = IssueRequest(superuserExistingBlockReq)
        ExpectStatusCode(t,
                "data manager request, existing block",
                http.StatusOK,
                response)
        // Expect response {"copies_deleted":1,"copies_failed":0}
-       expected_dc = deletecounter{1, 0}
-       json.NewDecoder(response.Body).Decode(&response_dc)
-       if response_dc != expected_dc {
-               t.Errorf("superuser_existing_block_req\nexpected: %+v\nreceived: %+v",
-                       expected_dc, response_dc)
+       expectedDc = deletecounter{1, 0}
+       json.NewDecoder(response.Body).Decode(&responseDc)
+       if responseDc != expectedDc {
+               t.Errorf("superuserExistingBlockReq\nexpected: %+v\nreceived: %+v",
+                       expectedDc, responseDc)
        }
        // Confirm the block has NOT been deleted.
        _, err = vols[0].Get(TEST_HASH)
@@ -591,12 +591,12 @@ func TestDeleteHandler(t *testing.T) {
 func TestPullHandler(t *testing.T) {
        defer teardown()
 
-       var user_token = "USER TOKEN"
+       var userToken = "USER TOKEN"
        data_manager_token = "DATA MANAGER TOKEN"
 
        pullq = NewWorkQueue()
 
-       good_json := []byte(`[
+       goodJSON := []byte(`[
                {
                        "locator":"locator_with_two_servers",
                        "servers":[
@@ -614,36 +614,36 @@ func TestPullHandler(t *testing.T) {
                }
        ]`)
 
-       bad_json := []byte(`{ "key":"I'm a little teapot" }`)
+       badJSON := []byte(`{ "key":"I'm a little teapot" }`)
 
        type pullTest struct {
-               name          string
-               req           RequestTester
-               response_code int
-               response_body string
+               name         string
+               req          RequestTester
+               responseCode int
+               responseBody string
        }
        var testcases = []pullTest{
                {
                        "Valid pull list from an ordinary user",
-                       RequestTester{"/pull", user_token, "PUT", good_json},
+                       RequestTester{"/pull", userToken, "PUT", goodJSON},
                        http.StatusUnauthorized,
                        "Unauthorized\n",
                },
                {
                        "Invalid pull request from an ordinary user",
-                       RequestTester{"/pull", user_token, "PUT", bad_json},
+                       RequestTester{"/pull", userToken, "PUT", badJSON},
                        http.StatusUnauthorized,
                        "Unauthorized\n",
                },
                {
                        "Valid pull request from the data manager",
-                       RequestTester{"/pull", data_manager_token, "PUT", good_json},
+                       RequestTester{"/pull", data_manager_token, "PUT", goodJSON},
                        http.StatusOK,
                        "Received 3 pull requests\n",
                },
                {
                        "Invalid pull request from the data manager",
-                       RequestTester{"/pull", data_manager_token, "PUT", bad_json},
+                       RequestTester{"/pull", data_manager_token, "PUT", badJSON},
                        http.StatusBadRequest,
                        "",
                },
@@ -651,8 +651,8 @@ func TestPullHandler(t *testing.T) {
 
        for _, tst := range testcases {
                response := IssueRequest(&tst.req)
-               ExpectStatusCode(t, tst.name, tst.response_code, response)
-               ExpectBody(t, tst.name, tst.response_body, response)
+               ExpectStatusCode(t, tst.name, tst.responseCode, response)
+               ExpectBody(t, tst.name, tst.responseBody, response)
        }
 
        // The Keep pull manager should have received one good list with 3
@@ -697,12 +697,12 @@ func TestPullHandler(t *testing.T) {
 func TestTrashHandler(t *testing.T) {
        defer teardown()
 
-       var user_token = "USER TOKEN"
+       var userToken = "USER TOKEN"
        data_manager_token = "DATA MANAGER TOKEN"
 
        trashq = NewWorkQueue()
 
-       good_json := []byte(`[
+       goodJSON := []byte(`[
                {
                        "locator":"block1",
                        "block_mtime":1409082153
@@ -717,37 +717,37 @@ func TestTrashHandler(t *testing.T) {
                }
        ]`)
 
-       bad_json := []byte(`I am not a valid JSON string`)
+       badJSON := []byte(`I am not a valid JSON string`)
 
        type trashTest struct {
-               name          string
-               req           RequestTester
-               response_code int
-               response_body string
+               name         string
+               req          RequestTester
+               responseCode int
+               responseBody string
        }
 
        var testcases = []trashTest{
                {
                        "Valid trash list from an ordinary user",
-                       RequestTester{"/trash", user_token, "PUT", good_json},
+                       RequestTester{"/trash", userToken, "PUT", goodJSON},
                        http.StatusUnauthorized,
                        "Unauthorized\n",
                },
                {
                        "Invalid trash list from an ordinary user",
-                       RequestTester{"/trash", user_token, "PUT", bad_json},
+                       RequestTester{"/trash", userToken, "PUT", badJSON},
                        http.StatusUnauthorized,
                        "Unauthorized\n",
                },
                {
                        "Valid trash list from the data manager",
-                       RequestTester{"/trash", data_manager_token, "PUT", good_json},
+                       RequestTester{"/trash", data_manager_token, "PUT", goodJSON},
                        http.StatusOK,
                        "Received 3 trash requests\n",
                },
                {
                        "Invalid trash list from the data manager",
-                       RequestTester{"/trash", data_manager_token, "PUT", bad_json},
+                       RequestTester{"/trash", data_manager_token, "PUT", badJSON},
                        http.StatusBadRequest,
                        "",
                },
@@ -755,8 +755,8 @@ func TestTrashHandler(t *testing.T) {
 
        for _, tst := range testcases {
                response := IssueRequest(&tst.req)
-               ExpectStatusCode(t, tst.name, tst.response_code, response)
-               ExpectBody(t, tst.name, tst.response_body, response)
+               ExpectStatusCode(t, tst.name, tst.responseCode, response)
+               ExpectBody(t, tst.name, tst.responseBody, response)
        }
 
        // The trash collector should have received one good list with 3
@@ -779,10 +779,10 @@ func TestTrashHandler(t *testing.T) {
 // REST router.  It returns the HTTP response to the request.
 func IssueRequest(rt *RequestTester) *httptest.ResponseRecorder {
        response := httptest.NewRecorder()
-       body := bytes.NewReader(rt.request_body)
+       body := bytes.NewReader(rt.requestBody)
        req, _ := http.NewRequest(rt.method, rt.uri, body)
-       if rt.api_token != "" {
-               req.Header.Set("Authorization", "OAuth2 "+rt.api_token)
+       if rt.apiToken != "" {
+               req.Header.Set("Authorization", "OAuth2 "+rt.apiToken)
        }
        loggingRouter := MakeLoggingRESTRouter()
        loggingRouter.ServeHTTP(response, req)
@@ -794,22 +794,22 @@ func IssueRequest(rt *RequestTester) *httptest.ResponseRecorder {
 func ExpectStatusCode(
        t *testing.T,
        testname string,
-       expected_status int,
+       expectedStatus int,
        response *httptest.ResponseRecorder) {
-       if response.Code != expected_status {
+       if response.Code != expectedStatus {
                t.Errorf("%s: expected status %d, got %+v",
-                       testname, expected_status, response)
+                       testname, expectedStatus, response)
        }
 }
 
 func ExpectBody(
        t *testing.T,
        testname string,
-       expected_body string,
+       expectedBody string,
        response *httptest.ResponseRecorder) {
-       if expected_body != "" && response.Body.String() != expected_body {
+       if expectedBody != "" && response.Body.String() != expectedBody {
                t.Errorf("%s: expected response body '%s', got %+v",
-                       testname, expected_body, response)
+                       testname, expectedBody, response)
        }
 }
 
@@ -829,9 +829,9 @@ func TestPutNeedsOnlyOneBuffer(t *testing.T) {
                for i := 0; i < 2; i++ {
                        response := IssueRequest(
                                &RequestTester{
-                                       method:       "PUT",
-                                       uri:          "/" + TEST_HASH,
-                                       request_body: TEST_BLOCK,
+                                       method:      "PUT",
+                                       uri:         "/" + TEST_HASH,
+                                       requestBody: TEST_BLOCK,
                                })
                        ExpectStatusCode(t,
                                "TestPutNeedsOnlyOneBuffer", http.StatusOK, response)
@@ -857,15 +857,15 @@ func TestPutHandlerNoBufferleak(t *testing.T) {
 
        ok := make(chan bool)
        go func() {
-               for i := 0; i < maxBuffers+1; i += 1 {
+               for i := 0; i < maxBuffers+1; i++ {
                        // Unauthenticated request, no server key
                        // => OK (unsigned response)
-                       unsigned_locator := "/" + TEST_HASH
+                       unsignedLocator := "/" + TEST_HASH
                        response := IssueRequest(
                                &RequestTester{
-                                       method:       "PUT",
-                                       uri:          unsigned_locator,
-                                       request_body: TEST_BLOCK,
+                                       method:      "PUT",
+                                       uri:         unsignedLocator,
+                                       requestBody: TEST_BLOCK,
                                })
                        ExpectStatusCode(t,
                                "TestPutHandlerBufferleak", http.StatusOK, response)
@@ -899,14 +899,14 @@ func TestGetHandlerNoBufferleak(t *testing.T) {
 
        ok := make(chan bool)
        go func() {
-               for i := 0; i < maxBuffers+1; i += 1 {
+               for i := 0; i < maxBuffers+1; i++ {
                        // Unauthenticated request, unsigned locator
                        // => OK
-                       unsigned_locator := "/" + TEST_HASH
+                       unsignedLocator := "/" + TEST_HASH
                        response := IssueRequest(
                                &RequestTester{
                                        method: "GET",
-                                       uri:    unsigned_locator,
+                                       uri:    unsignedLocator,
                                })
                        ExpectStatusCode(t,
                                "Unauthenticated request, unsigned locator", http.StatusOK, response)