1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-22 22:15:17 -04:00

Added: Enable Download Client Priorities (#2699)

Fixes #229
This commit is contained in:
Qstick
2018-04-14 23:03:32 -04:00
committed by Leonardo Galli
parent 17c100a7e7
commit 38932d82db
24 changed files with 242 additions and 53 deletions
@@ -33,7 +33,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbVortexTests
Port = 2222,
ApiKey = "1234-ABCD",
TvCategory = "tv",
RecentTvPriority = (int)NzbgetPriority.High
RecentMoviePriority = (int)NzbgetPriority.High
};
_queued = new NzbVortexQueueItem
@@ -31,7 +31,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetTests
Username = "admin",
Password = "pass",
MovieCategory = "movie",
RecentTvPriority = (int)NzbgetPriority.High
RecentMoviePriority = (int)NzbgetPriority.High
};
_queued = new NzbgetQueueItem
@@ -89,6 +89,12 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests
});
}
protected void GivenHighPriority()
{
Subject.Definition.Settings.As<QBittorrentSettings>().OlderMoviePriority = (int) QBittorrentPriority.First;
Subject.Definition.Settings.As<QBittorrentSettings>().RecentMoviePriority = (int) QBittorrentPriority.First;
}
protected void GivenMaxRatio(float maxRatio, bool removeOnMaxRatio = true)
{
Mocker.GetMock<IQBittorrentProxy>()
@@ -265,6 +271,39 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests
id.Should().Be(expectedHash);
}
[Test]
public void Download_should_set_top_priority()
{
GivenHighPriority();
GivenSuccessfulDownload();
var remoteMovie = CreateRemoteMovie();
var id = Subject.Download(remoteMovie);
Mocker.GetMock<IQBittorrentProxy>()
.Verify(v => v.MoveTorrentToTopInQueue(It.IsAny<string>(), It.IsAny<QBittorrentSettings>()), Times.Once());
}
[Test]
public void Download_should_not_fail_if_top_priority_not_available()
{
GivenHighPriority();
GivenSuccessfulDownload();
Mocker.GetMock<IQBittorrentProxy>()
.Setup(v => v.MoveTorrentToTopInQueue(It.IsAny<string>(), It.IsAny<QBittorrentSettings>()))
.Throws(new HttpException(new HttpResponse(new HttpRequest("http://me.local/"), new HttpHeader(), new byte[0], System.Net.HttpStatusCode.Forbidden)));
var remoteMovie = CreateRemoteMovie();
var id = Subject.Download(remoteMovie);
id.Should().NotBeNullOrEmpty();
ExceptionVerification.ExpectedWarns(1);
}
[Test]
public void should_return_status_with_outputdirs()
{
@@ -37,7 +37,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
Username = "admin",
Password = "pass",
MovieCategory = "movie",
RecentTvPriority = (int)SabnzbdPriority.High
RecentMoviePriority = (int)SabnzbdPriority.High
};
_queued = new SabnzbdQueue
{