mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-26 22:46:53 -04:00
Fixed: Removing completed download from SABnzbd
Closes #4445 (cherry picked from commit c669be317fffa252d59851e9a8ca9e56032a01fb)
This commit is contained in:
committed by
Robin Dadswell
parent
9bf872c9fa
commit
efdb9c20d4
+10
-4
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
@@ -25,6 +26,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole
|
||||
protected string _blackholeFolder;
|
||||
protected string _filePath;
|
||||
protected string _magnetFilePath;
|
||||
protected DownloadClientItem _downloadClientItem;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
@@ -34,6 +36,10 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole
|
||||
_filePath = (@"c:\blackhole\torrent\" + _title + ".torrent").AsOsAgnostic();
|
||||
_magnetFilePath = Path.ChangeExtension(_filePath, ".magnet");
|
||||
|
||||
_downloadClientItem = Builder<DownloadClientItem>
|
||||
.CreateNew().With(d => d.DownloadId = "_Droned.S01E01.Pilot.1080p.WEB-DL-DRONE_0")
|
||||
.Build();
|
||||
|
||||
Mocker.SetConstant<IScanWatchFolder>(Mocker.Resolve<ScanWatchFolder>());
|
||||
|
||||
Subject.Definition = new DownloadClientDefinition();
|
||||
@@ -246,7 +252,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole
|
||||
.Setup(c => c.FileExists(It.IsAny<string>()))
|
||||
.Returns(true);
|
||||
|
||||
Subject.RemoveItem("_Droned.1998.1080p.WEB-DL-DRONE_0", true);
|
||||
Subject.RemoveItem(_downloadClientItem, true);
|
||||
|
||||
Mocker.GetMock<IDiskProvider>()
|
||||
.Verify(c => c.DeleteFile(It.IsAny<string>()), Times.Once());
|
||||
@@ -261,7 +267,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole
|
||||
.Setup(c => c.FolderExists(It.IsAny<string>()))
|
||||
.Returns(true);
|
||||
|
||||
Subject.RemoveItem("_Droned.1998.1080p.WEB-DL-DRONE_0", true);
|
||||
Subject.RemoveItem(_downloadClientItem, true);
|
||||
|
||||
Mocker.GetMock<IDiskProvider>()
|
||||
.Verify(c => c.DeleteFolder(It.IsAny<string>(), true), Times.Once());
|
||||
@@ -270,7 +276,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole
|
||||
[Test]
|
||||
public void RemoveItem_should_ignore_if_unknown_item()
|
||||
{
|
||||
Subject.RemoveItem("_Droned.1998.1080p.WEB-DL-DRONE_0", true);
|
||||
Subject.RemoveItem(_downloadClientItem, true);
|
||||
|
||||
Mocker.GetMock<IDiskProvider>()
|
||||
.Verify(c => c.DeleteFile(It.IsAny<string>()), Times.Never());
|
||||
@@ -284,7 +290,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole
|
||||
{
|
||||
GivenCompletedItem();
|
||||
|
||||
Assert.Throws<NotSupportedException>(() => Subject.RemoveItem("_Droned.1998.1080p.WEB-DL-DRONE_0", false));
|
||||
Assert.Throws<NotSupportedException>(() => Subject.RemoveItem(_downloadClientItem, false));
|
||||
|
||||
Mocker.GetMock<IDiskProvider>()
|
||||
.Verify(c => c.DeleteFile(It.IsAny<string>()), Times.Never());
|
||||
|
||||
+10
-4
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
@@ -21,6 +22,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole
|
||||
protected string _completedDownloadFolder;
|
||||
protected string _blackholeFolder;
|
||||
protected string _filePath;
|
||||
protected DownloadClientItem _downloadClientItem;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
@@ -29,6 +31,10 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole
|
||||
_blackholeFolder = @"c:\blackhole\nzb".AsOsAgnostic();
|
||||
_filePath = (@"c:\blackhole\nzb\" + _title + ".nzb").AsOsAgnostic();
|
||||
|
||||
_downloadClientItem = Builder<DownloadClientItem>
|
||||
.CreateNew().With(d => d.DownloadId = "_Droned.S01E01.Pilot.1080p.WEB-DL-DRONE_0")
|
||||
.Build();
|
||||
|
||||
Mocker.SetConstant<IScanWatchFolder>(Mocker.Resolve<ScanWatchFolder>());
|
||||
|
||||
Subject.Definition = new DownloadClientDefinition();
|
||||
@@ -143,7 +149,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole
|
||||
.Setup(c => c.FileExists(It.IsAny<string>()))
|
||||
.Returns(true);
|
||||
|
||||
Subject.RemoveItem("_Droned.1998.1080p.WEB-DL-DRONE_0", true);
|
||||
Subject.RemoveItem(_downloadClientItem, true);
|
||||
|
||||
Mocker.GetMock<IDiskProvider>()
|
||||
.Verify(c => c.DeleteFile(It.IsAny<string>()), Times.Once());
|
||||
@@ -158,7 +164,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole
|
||||
.Setup(c => c.FolderExists(It.IsAny<string>()))
|
||||
.Returns(true);
|
||||
|
||||
Subject.RemoveItem("_Droned.1998.1080p.WEB-DL-DRONE_0", true);
|
||||
Subject.RemoveItem(_downloadClientItem, true);
|
||||
|
||||
Mocker.GetMock<IDiskProvider>()
|
||||
.Verify(c => c.DeleteFolder(It.IsAny<string>(), true), Times.Once());
|
||||
@@ -167,7 +173,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole
|
||||
[Test]
|
||||
public void RemoveItem_should_ignore_if_unknown_item()
|
||||
{
|
||||
Subject.RemoveItem("_Droned.1998.1080p.WEB-DL-DRONE_0", true);
|
||||
Subject.RemoveItem(_downloadClientItem, true);
|
||||
|
||||
Mocker.GetMock<IDiskProvider>()
|
||||
.Verify(c => c.DeleteFile(It.IsAny<string>()), Times.Never());
|
||||
@@ -181,7 +187,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole
|
||||
{
|
||||
GivenCompletedItem();
|
||||
|
||||
Assert.Throws<NotSupportedException>(() => Subject.RemoveItem("_Droned.1998.1080p.WEB-DL-DRONE_0", false));
|
||||
Assert.Throws<NotSupportedException>(() => Subject.RemoveItem(_downloadClientItem, false));
|
||||
|
||||
Mocker.GetMock<IDiskProvider>()
|
||||
.Verify(c => c.DeleteFile(It.IsAny<string>()), Times.Never());
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
@@ -20,6 +21,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetTests
|
||||
private NzbgetHistoryItem _failed;
|
||||
private NzbgetHistoryItem _completed;
|
||||
private Dictionary<string, string> _configItems;
|
||||
private DownloadClientItem _downloadClientItem;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
@@ -74,6 +76,10 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetTests
|
||||
MarkStatus = "NONE"
|
||||
};
|
||||
|
||||
_downloadClientItem = Builder<DownloadClientItem>
|
||||
.CreateNew().With(d => d.DownloadId = "_Droned.S01E01.Pilot.1080p.WEB-DL-DRONE_0")
|
||||
.Build();
|
||||
|
||||
Mocker.GetMock<INzbgetProxy>()
|
||||
.Setup(s => s.GetGlobalStatus(It.IsAny<NzbgetSettings>()))
|
||||
.Returns(new NzbgetGlobalStatus
|
||||
@@ -155,7 +161,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetTests
|
||||
.Setup(v => v.FolderExists(It.IsAny<string>()))
|
||||
.Returns(true);
|
||||
|
||||
Subject.RemoveItem("id", true);
|
||||
Subject.RemoveItem(_downloadClientItem, true);
|
||||
|
||||
Mocker.GetMock<IDiskProvider>()
|
||||
.Verify(v => v.DeleteFolder(It.IsAny<string>(), true), Times.Once());
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using FizzWare.NBuilder;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Http;
|
||||
@@ -21,6 +22,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests
|
||||
private string _strmFolder;
|
||||
private string _nzbPath;
|
||||
private RemoteMovie _remoteMovie;
|
||||
private DownloadClientItem _downloadClientItem;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
@@ -37,6 +39,10 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests
|
||||
|
||||
_remoteMovie.ParsedMovieInfo = new ParsedMovieInfo();
|
||||
|
||||
_downloadClientItem = Builder<DownloadClientItem>
|
||||
.CreateNew().With(d => d.DownloadId = "_Droned.S01E01.Pilot.1080p.WEB-DL-DRONE_0")
|
||||
.Build();
|
||||
|
||||
Subject.Definition = new DownloadClientDefinition();
|
||||
Subject.Definition.Settings = new PneumaticSettings
|
||||
{
|
||||
@@ -69,7 +75,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests
|
||||
[Test]
|
||||
public void should_throw_item_is_removed()
|
||||
{
|
||||
Assert.Throws<NotSupportedException>(() => Subject.RemoveItem("", true));
|
||||
Assert.Throws<NotSupportedException>(() => Subject.RemoveItem(_downloadClientItem, true));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
@@ -22,6 +23,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
|
||||
private SabnzbdHistory _completed;
|
||||
private SabnzbdConfig _config;
|
||||
private SabnzbdFullStatus _fullStatus;
|
||||
private DownloadClientItem _downloadClientItem;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
@@ -99,6 +101,10 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
|
||||
}
|
||||
};
|
||||
|
||||
_downloadClientItem = Builder<DownloadClientItem>
|
||||
.CreateNew().With(d => d.DownloadId = _completed.Items.First().Id)
|
||||
.Build();
|
||||
|
||||
Mocker.GetMock<ISabnzbdProxy>()
|
||||
.Setup(v => v.GetVersion(It.IsAny<SabnzbdSettings>()))
|
||||
.Returns("1.2.3");
|
||||
@@ -592,7 +598,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
|
||||
GivenQueue(null);
|
||||
GivenHistory(_completed);
|
||||
|
||||
Subject.RemoveItem(_completed.Items.First().Id, true);
|
||||
Subject.RemoveItem(_downloadClientItem, true);
|
||||
|
||||
Mocker.GetMock<IDiskProvider>()
|
||||
.Verify(v => v.DeleteFolder(path, true), Times.Once);
|
||||
@@ -619,7 +625,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
|
||||
GivenQueue(null);
|
||||
GivenHistory(_completed);
|
||||
|
||||
Subject.RemoveItem(_completed.Items.First().Id, true);
|
||||
Subject.RemoveItem(_downloadClientItem, true);
|
||||
|
||||
Mocker.GetMock<IDiskProvider>()
|
||||
.Verify(v => v.DeleteFolder(path, true), Times.Never);
|
||||
@@ -646,7 +652,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
|
||||
GivenQueue(null);
|
||||
GivenHistory(_completed);
|
||||
|
||||
Subject.RemoveItem(_completed.Items.First().Id, true);
|
||||
Subject.RemoveItem(_downloadClientItem, true);
|
||||
|
||||
Mocker.GetMock<IDiskProvider>()
|
||||
.Verify(v => v.DeleteFolder(path, true), Times.Never);
|
||||
@@ -673,7 +679,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
|
||||
GivenQueue(null);
|
||||
GivenHistory(_completed);
|
||||
|
||||
Subject.RemoveItem(_completed.Items.First().Id, false);
|
||||
Subject.RemoveItem(_downloadClientItem, false);
|
||||
|
||||
Mocker.GetMock<IDiskProvider>()
|
||||
.Verify(v => v.FolderExists(path), Times.Never);
|
||||
|
||||
Reference in New Issue
Block a user