mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
feat(indexers): test API from settings (#829)
* refactor(indexers): test api clients * feat(indexers): test api connection * fix(indexers): api client tests * refactor: indexer api clients * feat: add Toasts for indexer api tests * fix: failing red tests
This commit is contained in:
parent
fb9dcc23a0
commit
f3cfeed8cd
19 changed files with 475 additions and 191 deletions
|
@ -1,6 +1,7 @@
|
|||
package ptp
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
|
@ -87,9 +88,10 @@ func TestPTPClient_GetTorrentByID(t *testing.T) {
|
|||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
c := NewClient(tt.fields.Url, tt.fields.APIUser, tt.fields.APIKey)
|
||||
c := NewClient(tt.fields.APIUser, tt.fields.APIKey)
|
||||
c.UseURL(tt.fields.Url)
|
||||
|
||||
got, err := c.GetTorrentByID(tt.args.torrentID)
|
||||
got, err := c.GetTorrentByID(context.Background(), tt.args.torrentID)
|
||||
if tt.wantErr && assert.Error(t, err) {
|
||||
assert.Equal(t, tt.wantErr, err)
|
||||
}
|
||||
|
@ -163,9 +165,10 @@ func Test(t *testing.T) {
|
|||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
c := NewClient(tt.fields.Url, tt.fields.APIUser, tt.fields.APIKey)
|
||||
c := NewClient(tt.fields.APIUser, tt.fields.APIKey)
|
||||
c.UseURL(tt.fields.Url)
|
||||
|
||||
got, err := c.TestAPI()
|
||||
got, err := c.TestAPI(context.Background())
|
||||
|
||||
if tt.wantErr && assert.Error(t, err) {
|
||||
assert.Equal(t, tt.wantErr, err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue