mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 16:59:12 +00:00
feat: return action rejections from arrs (#103)
* refactor: push status * feat: return push status for arr actions
This commit is contained in:
parent
20138030e1
commit
373c85f060
16 changed files with 294 additions and 255 deletions
|
@ -46,11 +46,12 @@ func Test_client_Push(t *testing.T) {
|
|||
release Release
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
fields fields
|
||||
args args
|
||||
err error
|
||||
wantErr bool
|
||||
name string
|
||||
fields fields
|
||||
args args
|
||||
err error
|
||||
rejections []string
|
||||
wantErr bool
|
||||
}{
|
||||
{
|
||||
name: "push",
|
||||
|
@ -72,8 +73,7 @@ func Test_client_Push(t *testing.T) {
|
|||
Protocol: "torrent",
|
||||
PublishDate: "2021-08-21T15:36:00Z",
|
||||
}},
|
||||
err: errors.New("lidarr push rejected Unknown Artist"),
|
||||
wantErr: true,
|
||||
rejections: []string{"Unknown Artist"},
|
||||
},
|
||||
{
|
||||
name: "push_error",
|
||||
|
@ -95,15 +95,15 @@ func Test_client_Push(t *testing.T) {
|
|||
Protocol: "torrent",
|
||||
PublishDate: "2021-08-21T15:36:00Z",
|
||||
}},
|
||||
err: errors.New("lidarr push rejected Unknown Artist"),
|
||||
wantErr: true,
|
||||
rejections: []string{"Unknown Artist"},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
c := New(tt.fields.config)
|
||||
|
||||
_, _, err := c.Push(tt.args.release)
|
||||
rejections, err := c.Push(tt.args.release)
|
||||
assert.Equal(t, tt.rejections, rejections)
|
||||
if tt.wantErr && assert.Error(t, err) {
|
||||
assert.Equal(t, tt.err, err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue