Fixed cutoff unmet integration tests

This commit is contained in:
Mark McDowall 2022-05-23 20:52:27 -07:00
parent ccb88919b9
commit c1e5b7f642
2 changed files with 17 additions and 5 deletions

View File

@ -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);

View File

@ -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);
}