From c1e5b7f642d03414f7c5587d4db377ef979f2067 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Mon, 23 May 2022 20:52:27 -0700 Subject: [PATCH] Fixed cutoff unmet integration tests --- .../ApiTests/WantedTests/CutoffUnmetFixture.cs | 8 ++++---- .../IntegrationTestBase.cs | 14 +++++++++++++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/NzbDrone.Integration.Test/ApiTests/WantedTests/CutoffUnmetFixture.cs b/src/NzbDrone.Integration.Test/ApiTests/WantedTests/CutoffUnmetFixture.cs index 72b8700d5..2270faa35 100644 --- a/src/NzbDrone.Integration.Test/ApiTests/WantedTests/CutoffUnmetFixture.cs +++ b/src/NzbDrone.Integration.Test/ApiTests/WantedTests/CutoffUnmetFixture.cs @@ -11,7 +11,7 @@ namespace NzbDrone.Integration.Test.ApiTests.WantedTests [Test, Order(1)] public void cutoff_should_have_monitored_items() { - EnsureProfileCutoff(1, Quality.HDTV720p); + EnsureProfileCutoff(1, Quality.HDTV720p, true); var series = EnsureSeries(266189, "The Blacklist", true); EnsureEpisodeFile(series, 1, 1, Quality.SDTV); @@ -23,7 +23,7 @@ namespace NzbDrone.Integration.Test.ApiTests.WantedTests [Test, Order(1)] public void cutoff_should_not_have_unmonitored_items() { - EnsureProfileCutoff(1, Quality.HDTV720p); + EnsureProfileCutoff(1, Quality.HDTV720p, true); var series = EnsureSeries(266189, "The Blacklist", false); EnsureEpisodeFile(series, 1, 1, Quality.SDTV); @@ -35,7 +35,7 @@ namespace NzbDrone.Integration.Test.ApiTests.WantedTests [Test, Order(1)] public void cutoff_should_have_series() { - EnsureProfileCutoff(1, Quality.HDTV720p); + EnsureProfileCutoff(1, Quality.HDTV720p, true); var series = EnsureSeries(266189, "The Blacklist", true); EnsureEpisodeFile(series, 1, 1, Quality.SDTV); @@ -48,7 +48,7 @@ namespace NzbDrone.Integration.Test.ApiTests.WantedTests [Test, Order(2)] public void cutoff_should_have_unmonitored_items() { - EnsureProfileCutoff(1, Quality.HDTV720p); + EnsureProfileCutoff(1, Quality.HDTV720p, true); var series = EnsureSeries(266189, "The Blacklist", false); EnsureEpisodeFile(series, 1, 1, Quality.SDTV); diff --git a/src/NzbDrone.Integration.Test/IntegrationTestBase.cs b/src/NzbDrone.Integration.Test/IntegrationTestBase.cs index 4078dfb79..848ddbea1 100644 --- a/src/NzbDrone.Integration.Test/IntegrationTestBase.cs +++ b/src/NzbDrone.Integration.Test/IntegrationTestBase.cs @@ -308,13 +308,25 @@ namespace NzbDrone.Integration.Test return result.EpisodeFile; } - public ProfileResource EnsureProfileCutoff(int profileId, Quality cutoff) + public ProfileResource EnsureProfileCutoff(int profileId, Quality cutoff, bool upgradeAllowed) { + var needsUpdate = false; var profile = Profiles.Get(profileId); if (profile.Cutoff != cutoff) { profile.Cutoff = cutoff; + needsUpdate = true; + } + + if (profile.UpgradeAllowed != upgradeAllowed) + { + profile.UpgradeAllowed = upgradeAllowed; + needsUpdate = true; + } + + if (needsUpdate) + { profile = Profiles.Put(profile); }