middleware/torrentapproval : make use of ErrTorrentUnapproved
This commit is contained in:
parent
c9d51e8e68
commit
757ebf1241
1 changed files with 4 additions and 3 deletions
|
@ -6,8 +6,9 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/chihaya/chihaya/bittorrent"
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
|
"github.com/chihaya/chihaya/bittorrent"
|
||||||
)
|
)
|
||||||
|
|
||||||
var cases = []struct {
|
var cases = []struct {
|
||||||
|
@ -69,9 +70,9 @@ func TestHandleAnnounce(t *testing.T) {
|
||||||
nctx, err := h.HandleAnnounce(ctx, req, resp)
|
nctx, err := h.HandleAnnounce(ctx, req, resp)
|
||||||
require.Equal(t, ctx, nctx)
|
require.Equal(t, ctx, nctx)
|
||||||
if tt.approved == true {
|
if tt.approved == true {
|
||||||
require.Nil(t, err)
|
require.NotEqual(t, err, ErrTorrentUnapproved)
|
||||||
} else {
|
} else {
|
||||||
require.NotNil(t, err)
|
require.Equal(t, err, ErrTorrentUnapproved)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue