Fix Sonarr TV request policy and bump gateway to 0.1.40

This commit is contained in:
ponzischeme89
2026-08-14 10:30:25 +12:00
parent 5e2ed3d12e
commit 19f08e6293
11 changed files with 366 additions and 29 deletions
+4 -8
View File
@@ -46,13 +46,9 @@ func TestCalendarUsesV3APIAndKeepsKeyInHeader(t *testing.T) {
}
}
func TestAddRequestedUsesDefaultsAndStartsSearch(t *testing.T) {
func TestAddRequestedUsesExplicitPolicyWithoutSearching(t *testing.T) {
upstream := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case "/api/v3/rootfolder":
_, _ = w.Write([]byte(`[{"path":"/tv"}]`))
case "/api/v3/qualityprofile":
_, _ = w.Write([]byte(`[{"id":3}]`))
case "/api/v3/series":
var body map[string]any
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
@@ -67,8 +63,8 @@ func TestAddRequestedUsesDefaultsAndStartsSearch(t *testing.T) {
t.Errorf("season was not monitored: %#v", body)
}
options := body["addOptions"].(map[string]any)
if options["searchForMissingEpisodes"] != true {
t.Errorf("episode search was not enabled: %#v", body)
if options["searchForMissingEpisodes"] != false {
t.Errorf("episode search was unexpectedly enabled: %#v", body)
}
_, _ = w.Write([]byte(`{"id":8,"tvdbId":44,"title":"Severance"}`))
default:
@@ -81,7 +77,7 @@ func TestAddRequestedUsesDefaultsAndStartsSearch(t *testing.T) {
context.Background(), Series{
TVDBID: 44, Title: "Severance",
Seasons: []Season{{SeasonNumber: 1}},
},
}, "/tv", RequestOptions{QualityProfileID: 3, SearchImmediately: false},
)
if err != nil {
t.Fatal(err)