Skip to content

Commit

Permalink
test: use assert.ErrorIs()
Browse files Browse the repository at this point in the history
  • Loading branch information
clambin committed Jan 23, 2023
1 parent 9c8d38b commit 05f0d56
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 2 additions & 3 deletions pkg/mediaclient/plex/plex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package plex_test

import (
"context"
"errors"
"github.com/clambin/mediamon/pkg/mediaclient/plex"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -99,7 +98,7 @@ func TestPlexClient_Authentication_Failure(t *testing.T) {

_, err := c.GetIdentity(context.Background())
require.Error(t, err)
assert.True(t, errors.Is(err, unix.ECONNREFUSED))
assert.ErrorIs(t, err, unix.ECONNREFUSED)
}

func TestClient_Failures(t *testing.T) {
Expand All @@ -122,7 +121,7 @@ func TestClient_Failures(t *testing.T) {
testServer.Close()
_, err = c.GetIdentity(context.Background())
require.Error(t, err)
assert.True(t, errors.Is(err, unix.ECONNREFUSED))
assert.ErrorIs(t, err, unix.ECONNREFUSED)
}

// Server handlers
Expand Down
3 changes: 1 addition & 2 deletions pkg/mediaclient/transmission/transmission.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ func (client *Client) call(ctx context.Context, method string, response interfac

switch resp.StatusCode {
case http.StatusOK:
decoder := json.NewDecoder(resp.Body)
err = decoder.Decode(response)
err = json.NewDecoder(resp.Body).Decode(response)
answer = true
case http.StatusConflict:
// Transmission-Session-Id has expired. Get the new one and retry
Expand Down

0 comments on commit 05f0d56

Please sign in to comment.