From 757ebf12417fc90a43f2a92371f05732c09662ff Mon Sep 17 00:00:00 2001 From: Pierre-Alain TORET Date: Thu, 20 Sep 2018 18:05:12 +0200 Subject: [PATCH] middleware/torrentapproval : make use of ErrTorrentUnapproved --- middleware/torrentapproval/torrentapproval_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/middleware/torrentapproval/torrentapproval_test.go b/middleware/torrentapproval/torrentapproval_test.go index b20966c..72ad41f 100644 --- a/middleware/torrentapproval/torrentapproval_test.go +++ b/middleware/torrentapproval/torrentapproval_test.go @@ -6,8 +6,9 @@ import ( "fmt" "testing" - "github.com/chihaya/chihaya/bittorrent" "github.com/stretchr/testify/require" + + "github.com/chihaya/chihaya/bittorrent" ) var cases = []struct { @@ -69,9 +70,9 @@ func TestHandleAnnounce(t *testing.T) { nctx, err := h.HandleAnnounce(ctx, req, resp) require.Equal(t, ctx, nctx) if tt.approved == true { - require.Nil(t, err) + require.NotEqual(t, err, ErrTorrentUnapproved) } else { - require.NotNil(t, err) + require.Equal(t, err, ErrTorrentUnapproved) } }) }