-
Notifications
You must be signed in to change notification settings - Fork 8
/
rarbg_test.go
34 lines (28 loc) · 1 KB
/
rarbg_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package imdb2torrent
import (
"context"
"fmt"
"strings"
"testing"
"github.com/stretchr/testify/require"
"go.uber.org/zap"
)
func TestRARBGMovie(t *testing.T) {
cache := NewInMemoryCache()
logger := zap.NewNop()
client := NewRARBGclient(DefaultRARBGclientOpts, cache, logger, false)
imdbID := "tt0063350" // Night of the Living Dead, 1968, public domain
torrents, err := client.FindMovie(context.Background(), imdbID)
require.NoError(t, err)
require.NotEmpty(t, torrents)
firstElem := torrents[0]
fmt.Printf("RARBG result first elem: %+v\n", firstElem)
require.NotEmpty(t, firstElem.Name)
require.Len(t, firstElem.InfoHash, 40)
require.True(t, strings.HasPrefix(firstElem.MagnetURL, "magnet:?xt=urn:btih:"+firstElem.InfoHash))
require.Regexp(t, qualityRegex, firstElem.Quality)
// RARBG response doesn't contain a title, and it doesn't use the metaGetter
// require.Equal(t, firstElem.Title, "Night of the Living Dead")
require.Greater(t, firstElem.Size, 0)
require.Greater(t, firstElem.Seeders, 0)
}