From 15bd181f165e5cc0176a5d5b19059f7be74f79ef Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Tue, 19 Dec 2017 22:49:27 +0100 Subject: [PATCH] Fixed failing tests in DownloadStation. --- .../DownloadStationTests/TorrentDownloadStationFixture.cs | 1 + .../DownloadStationTests/UsenetDownloadStationFixture.cs | 1 + .../Download/Clients/DownloadStation/TorrentDownloadStation.cs | 2 ++ .../Download/Clients/DownloadStation/UsenetDownloadStation.cs | 2 ++ 4 files changed, 6 insertions(+) diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/TorrentDownloadStationFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/TorrentDownloadStationFixture.cs index fb3eb9962..0b571e4eb 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/TorrentDownloadStationFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/TorrentDownloadStationFixture.cs @@ -610,6 +610,7 @@ public void GetItems_should_return_canBeMoved_and_canBeDeleted_as_expected(Downl [TestCase(DownloadStationTaskStatus.Seeding, DownloadItemStatus.Completed)] [TestCase(DownloadStationTaskStatus.FilehostingWaiting, DownloadItemStatus.Queued)] [TestCase(DownloadStationTaskStatus.Waiting, DownloadItemStatus.Queued)] + [TestCase(DownloadStationTaskStatus.Unknown, DownloadItemStatus.Queued)] public void GetItems_should_return_item_as_downloadItemStatus(DownloadStationTaskStatus apiStatus, DownloadItemStatus expectedItemStatus) { GivenSerialNumber(); diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/UsenetDownloadStationFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/UsenetDownloadStationFixture.cs index f1d199b35..14c94e808 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/UsenetDownloadStationFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/UsenetDownloadStationFixture.cs @@ -419,6 +419,7 @@ public void GetItems_should_map_outputpath_for_completed_or_failed_tasks() [TestCase(DownloadStationTaskStatus.Seeding, DownloadItemStatus.Completed)] [TestCase(DownloadStationTaskStatus.FilehostingWaiting, DownloadItemStatus.Queued)] [TestCase(DownloadStationTaskStatus.Waiting, DownloadItemStatus.Queued)] + [TestCase(DownloadStationTaskStatus.Unknown, DownloadItemStatus.Queued)] public void GetItems_should_return_item_as_downloadItemStatus(DownloadStationTaskStatus apiStatus, DownloadItemStatus expectedItemStatus) { GivenSerialNumber(); diff --git a/src/NzbDrone.Core/Download/Clients/DownloadStation/TorrentDownloadStation.cs b/src/NzbDrone.Core/Download/Clients/DownloadStation/TorrentDownloadStation.cs index 79c177b3f..10c24a10a 100644 --- a/src/NzbDrone.Core/Download/Clients/DownloadStation/TorrentDownloadStation.cs +++ b/src/NzbDrone.Core/Download/Clients/DownloadStation/TorrentDownloadStation.cs @@ -227,7 +227,9 @@ protected DownloadItemStatus GetStatus(DownloadStationTask torrent) { switch (torrent.Status) { + case DownloadStationTaskStatus.Unknown: case DownloadStationTaskStatus.Waiting: + case DownloadStationTaskStatus.FilehostingWaiting: return torrent.Size == 0 || GetRemainingSize(torrent) > 0 ? DownloadItemStatus.Queued : DownloadItemStatus.Completed; case DownloadStationTaskStatus.Paused: return DownloadItemStatus.Paused; diff --git a/src/NzbDrone.Core/Download/Clients/DownloadStation/UsenetDownloadStation.cs b/src/NzbDrone.Core/Download/Clients/DownloadStation/UsenetDownloadStation.cs index aed5d8362..f870d4567 100644 --- a/src/NzbDrone.Core/Download/Clients/DownloadStation/UsenetDownloadStation.cs +++ b/src/NzbDrone.Core/Download/Clients/DownloadStation/UsenetDownloadStation.cs @@ -315,7 +315,9 @@ protected DownloadItemStatus GetStatus(DownloadStationTask task) { switch (task.Status) { + case DownloadStationTaskStatus.Unknown: case DownloadStationTaskStatus.Waiting: + case DownloadStationTaskStatus.FilehostingWaiting: return task.Size == 0 || GetRemainingSize(task) > 0 ? DownloadItemStatus.Queued : DownloadItemStatus.Completed; case DownloadStationTaskStatus.Paused: return DownloadItemStatus.Paused;