Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
rekby committed Nov 24, 2019
1 parent b2e84a8 commit 2cfbd31
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 1 addition & 4 deletions internal/profiler/profiler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import (
)

func TestNew(t *testing.T) {
const argName = "pass"
const pass = "qwe"
td := testdeep.NewT(t)
profiler := New(zap.NewNop(), Config{AllowedNetworks: []string{"127.0.0.1/32", "::1/128"}})
td.Len(profiler.secretHandler.AllowedNetworks, 2)
Expand All @@ -21,8 +19,6 @@ func TestNew(t *testing.T) {
}

func TestProfiler_ServeHTTP(t *testing.T) {
const argName = "pass"
const pass = "qwe"
td := testdeep.NewT(t)
profiler := New(zap.NewNop(), Config{AllowedNetworks: []string{"127.0.0.1/32", "::1/128"}})

Expand All @@ -34,4 +30,5 @@ func TestProfiler_ServeHTTP(t *testing.T) {
resp := respWriter.Result()
td.Cmp(resp.StatusCode, http.StatusOK)
td.True(strings.Contains(resp.Header.Get("content-type"), "text/html"))
_ = resp.Body.Close()
}
3 changes: 3 additions & 0 deletions internal/profiler/secret_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func TestSecretHandler_ServeHTTP(t *testing.T) {
resp := respWriter.Result()
td.Cmp(resp.StatusCode, http.StatusOK)
td.True(nextCalled)
_ = resp.Body.Close()

nextCalled = false
respWriter = httptest.NewRecorder()
Expand All @@ -56,6 +57,7 @@ func TestSecretHandler_ServeHTTP(t *testing.T) {
td.Cmp(resp.StatusCode, http.StatusForbidden)
td.False(nextCalled)
nextCalled = false
_ = resp.Body.Close()

nextCalled = false
respWriter = httptest.NewRecorder()
Expand All @@ -67,4 +69,5 @@ func TestSecretHandler_ServeHTTP(t *testing.T) {
td.Cmp(resp.StatusCode, http.StatusInternalServerError)
td.False(nextCalled)
nextCalled = false
_ = resp.Body.Close()
}

0 comments on commit 2cfbd31

Please sign in to comment.