0.2.55 - Remote config/Request fixes

This commit is contained in:
ponzischeme89
2026-08-12 09:57:56 +12:00
parent 4b31946635
commit 9777eb0952
35 changed files with 1086 additions and 78 deletions
+6 -6
View File
@@ -48,7 +48,7 @@ func TestCalendarUsesV3APIAndKeepsKeyInHeader(t *testing.T) {
}
}
func TestAddUnmonitoredUsesDefaultsWithoutStartingSearch(t *testing.T) {
func TestAddRequestedUsesDefaultsAndStartsSearch(t *testing.T) {
upstream := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case "/api/v3/rootfolder":
@@ -60,13 +60,13 @@ func TestAddUnmonitoredUsesDefaultsWithoutStartingSearch(t *testing.T) {
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
t.Fatal(err)
}
if body["monitored"] != false || body["rootFolderPath"] != "/movies" ||
if body["monitored"] != true || body["rootFolderPath"] != "/movies" ||
body["qualityProfileId"] != float64(4) {
t.Errorf("unexpected add body: %#v", body)
}
options := body["addOptions"].(map[string]any)
if options["searchForMovie"] != false {
t.Errorf("movie search was enabled: %#v", body)
if options["searchForMovie"] != true {
t.Errorf("movie search was not enabled: %#v", body)
}
_, _ = w.Write([]byte(`{"id":9,"tmdbId":22,"title":"Arrival"}`))
default:
@@ -75,8 +75,8 @@ func TestAddUnmonitoredUsesDefaultsWithoutStartingSearch(t *testing.T) {
}))
defer upstream.Close()
added, err := New(upstream.URL, "secret", time.Second).AddUnmonitored(
context.Background(), Movie{TMDBID: 22, Title: "Arrival", Monitored: true},
added, err := New(upstream.URL, "secret", time.Second).AddRequested(
context.Background(), Movie{TMDBID: 22, Title: "Arrival"},
)
if err != nil {
t.Fatal(err)