Skip to content

Commit

Permalink
Lint related changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kinjelom committed Aug 26, 2024
1 parent 65224a6 commit 4ab70db
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions internal/keystore/credhub/credhub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ func NewFakeStore() (*FakeHTTPClient, *Store) {

type FakeHTTPClient struct {
reqMethod string
reqUri string
reqURI string
reqBody string
respStatusCodes map[string]int
respStatus string
Expand All @@ -328,7 +328,7 @@ func (m *FakeReadCloser) Close() error {

func (c *FakeHTTPClient) doRequest(_ context.Context, method, url string, body io.Reader) httpResponse {
c.reqMethod = method
c.reqUri = url
c.reqURI = url
c.reqBody = ""
if body != nil {
bodyBytes, err := io.ReadAll(body)
Expand Down Expand Up @@ -391,22 +391,22 @@ func assertRequest(t *testing.T, fc *FakeHTTPClient, method, uri string) {
if fc.reqMethod != method {
t.Fatalf("expected requested method '%s' but got '%s'", method, fc.reqMethod)
}
if fc.reqUri != uri {
t.Fatalf("expected requested uri '%s' but got '%s'", uri, fc.reqUri)
if fc.reqURI != uri {
t.Fatalf("expected requested uri '%s' but got '%s'", uri, fc.reqURI)
}
}
func assertRequestWithJSONBody(t *testing.T, fc *FakeHTTPClient, method, uri string, jsonBody string) {
assertRequest(t, fc, method, uri)

var gotJSON, expectedJson interface{}
var gotJSON, expectedJSON interface{}
err1 := json.Unmarshal([]byte(fc.reqBody), &gotJSON)
err2 := json.Unmarshal([]byte(jsonBody), &expectedJson)
err2 := json.Unmarshal([]byte(jsonBody), &expectedJSON)

if err1 != nil || err2 != nil {
t.Fatalf("jsons deserialization errors: %v, %v", err1, err2)
}

if !reflect.DeepEqual(gotJSON, expectedJson) {
if !reflect.DeepEqual(gotJSON, expectedJSON) {
t.Fatalf("expected requested body '%s' but got '%s'", jsonBody, fc.reqBody)
}
}

0 comments on commit 4ab70db

Please sign in to comment.