mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
Add support for using freeleech tokens if available
This commit is contained in:
parent
74f777340e
commit
3656a68a27
28 changed files with 199 additions and 39 deletions
|
@ -70,7 +70,7 @@ func TestREDClient_GetTorrentByID(t *testing.T) {
|
|||
Url: ts.URL,
|
||||
APIKey: key,
|
||||
},
|
||||
args: args{torrentID: "29991962"},
|
||||
args: args{torrentID: "29991962", freeleechToken: false},
|
||||
want: &domain.TorrentBasic{
|
||||
Id: "29991962",
|
||||
InfoHash: "B2BABD3A361EAFC6C4E9142C422DF7DDF5D7E163",
|
||||
|
@ -86,7 +86,7 @@ func TestREDClient_GetTorrentByID(t *testing.T) {
|
|||
Url: ts.URL,
|
||||
APIKey: key,
|
||||
},
|
||||
args: args{torrentID: "100002"},
|
||||
args: args{torrentID: "100002", freeleechToken: false},
|
||||
want: nil,
|
||||
wantErr: "could not get torrent by id: 100002: status code: 400 status: failure error: bad id parameter",
|
||||
},
|
||||
|
@ -96,7 +96,7 @@ func TestREDClient_GetTorrentByID(t *testing.T) {
|
|||
Url: ts.URL,
|
||||
APIKey: "",
|
||||
},
|
||||
args: args{torrentID: "100002"},
|
||||
args: args{torrentID: "100002", freeleechToken: false},
|
||||
want: nil,
|
||||
wantErr: "could not get torrent by id: 100002: RED client missing API key!",
|
||||
},
|
||||
|
@ -105,7 +105,7 @@ func TestREDClient_GetTorrentByID(t *testing.T) {
|
|||
t.Run(tt.name, func(t *testing.T) {
|
||||
c := NewClient(tt.fields.APIKey, WithUrl(ts.URL))
|
||||
|
||||
got, err := c.GetTorrentByID(context.Background(), tt.args.torrentID)
|
||||
got, err := c.GetTorrentByID(context.Background(), tt.args.torrentID, tt.args.freeleechToken)
|
||||
if tt.wantErr != "" && assert.Error(t, err) {
|
||||
assert.EqualErrorf(t, err, tt.wantErr, "Error should be: %v, got: %v", tt.wantErr, err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue