Skip to content

Commit 41b2b64

Browse files
committed
code review changes
1 parent 09868b1 commit 41b2b64

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

pkg/auth/auth_client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ func (c *KeycloakClient) requestToken(ctx context.Context) (*authResponse, error
130130
if resp.StatusCode != http.StatusOK {
131131
respBody, err := io.ReadAll(resp.Body)
132132
if err != nil {
133-
respBody = []byte("failed to read response body: " + err.Error())
133+
return nil, fmt.Errorf("authentication request failed with status: %s: %w body: %s", resp.Status, err, string(respBody))
134134
}
135135
return nil, fmt.Errorf("authentication request failed with status: %s: %s", resp.Status, string(respBody))
136136
}

pkg/auth/auth_client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func TestKeycloakClient_GetToken(t *testing.T) {
5252
// the other fields are also required in real scenario, but omit here for brevity
5353
})
5454
gotToken, err := client.GetToken(context.Background())
55-
assert.True(t, serverCallCount.Load() > 0, "server was not called")
55+
assert.Greater(t, serverCallCount.Load(), 0, "server was not called")
5656

5757
if tt.wantErr {
5858
require.Error(t, err)

pkg/notifications/notification_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ func TestClient_CreateNotification(t *testing.T) {
130130
err := client.CreateNotification(context.Background(), tt.notification)
131131

132132
if !tt.serverErrors.authenticationFail {
133-
assert.True(t, serverCallCount.Load() > 0, "notification server was not called")
133+
assert.Greater(t, serverCallCount.Load(), 0, "notification server was not called")
134134
}
135135

136136
if tt.wantErr {

0 commit comments

Comments
 (0)