mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-21 22:04:31 -04:00
Fixed: Map dsm shared folder to full path in status (#797)
* Fixed: Map dsm shared folder to full path in status * Add tests
This commit is contained in:
+47
@@ -7,6 +7,7 @@ using NUnit.Framework;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Download.Clients;
|
||||
using NzbDrone.Core.Download.Clients.DownloadStation;
|
||||
using NzbDrone.Core.Download.Clients.DownloadStation.Proxies;
|
||||
using NzbDrone.Core.MediaFiles.TorrentInfo;
|
||||
@@ -296,6 +297,17 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
.Returns<OsPath, DownloadStationSettings, string>((path, setttings, serial) => _physicalPath);
|
||||
}
|
||||
|
||||
protected void GivenSharedFolder(string share)
|
||||
{
|
||||
Mocker.GetMock<ISharedFolderResolver>()
|
||||
.Setup(s => s.RemapToFullPath(It.IsAny<OsPath>(), It.IsAny<DownloadStationSettings>(), It.IsAny<string>()))
|
||||
.Throws(new DownloadClientException("There is no matching shared folder"));
|
||||
|
||||
Mocker.GetMock<ISharedFolderResolver>()
|
||||
.Setup(s => s.RemapToFullPath(It.Is<OsPath>(x => x.FullPath == share), It.IsAny<DownloadStationSettings>(), It.IsAny<string>()))
|
||||
.Returns<OsPath, DownloadStationSettings, string>((path, setttings, serial) => _physicalPath);
|
||||
}
|
||||
|
||||
protected void GivenSerialNumber()
|
||||
{
|
||||
Mocker.GetMock<ISerialNumberProvider>()
|
||||
@@ -495,6 +507,41 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
.Verify(v => v.AddTaskFromUrl(It.IsAny<string>(), null, _settings), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetStatus_should_map_outputpath_when_using_default()
|
||||
{
|
||||
GivenSerialNumber();
|
||||
GivenSharedFolder("/somepath");
|
||||
|
||||
var status = Subject.GetStatus();
|
||||
|
||||
status.OutputRootFolders.First().Should().Be(_physicalPath);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetStatus_should_map_outputpath_when_using_destination()
|
||||
{
|
||||
GivenSerialNumber();
|
||||
GivenTvDirectory();
|
||||
GivenSharedFolder($"/{_musicDirectory}");
|
||||
|
||||
var status = Subject.GetStatus();
|
||||
|
||||
status.OutputRootFolders.First().Should().Be(_physicalPath);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetStatus_should_map_outputpath_when_using_category()
|
||||
{
|
||||
GivenSerialNumber();
|
||||
GivenMusicCategory();
|
||||
GivenSharedFolder($"/somepath/{_category}");
|
||||
|
||||
var status = Subject.GetStatus();
|
||||
|
||||
status.OutputRootFolders.First().Should().Be(_physicalPath);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetItems_should_set_outputPath_to_base_folder_when_single_file_non_finished_tasks()
|
||||
{
|
||||
|
||||
+48
-1
@@ -9,10 +9,10 @@ using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Download.Clients.DownloadStation;
|
||||
using NzbDrone.Core.Download.Clients.DownloadStation.Proxies;
|
||||
using NzbDrone.Core.MediaFiles.TorrentInfo;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Test.Common;
|
||||
using NzbDrone.Core.Organizer;
|
||||
using NzbDrone.Core.Download.Clients;
|
||||
|
||||
namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
{
|
||||
@@ -189,6 +189,18 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
.Returns<OsPath, DownloadStationSettings, string>((path, setttings, serial) => _physicalPath);
|
||||
}
|
||||
|
||||
protected void GivenSharedFolder(string share)
|
||||
{
|
||||
Mocker.GetMock<ISharedFolderResolver>()
|
||||
.Setup(s => s.RemapToFullPath(It.IsAny<OsPath>(), It.IsAny<DownloadStationSettings>(), It.IsAny<string>()))
|
||||
.Throws(new DownloadClientException("There is no matching shared folder"));
|
||||
|
||||
Mocker.GetMock<ISharedFolderResolver>()
|
||||
.Setup(s => s.RemapToFullPath(It.Is<OsPath>(x => x.FullPath == share), It.IsAny<DownloadStationSettings>(), It.IsAny<string>()))
|
||||
.Returns<OsPath, DownloadStationSettings, string>((path, setttings, serial) => _physicalPath);
|
||||
}
|
||||
|
||||
|
||||
protected void GivenSerialNumber()
|
||||
{
|
||||
Mocker.GetMock<ISerialNumberProvider>()
|
||||
@@ -373,6 +385,41 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests
|
||||
Mocker.GetMock<IDownloadStationTaskProxy>()
|
||||
.Verify(v => v.AddTaskFromUrl(It.IsAny<string>(), null, _settings), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetStatus_should_map_outputpath_when_using_default()
|
||||
{
|
||||
GivenSerialNumber();
|
||||
GivenSharedFolder("/somepath");
|
||||
|
||||
var status = Subject.GetStatus();
|
||||
|
||||
status.OutputRootFolders.First().Should().Be(_physicalPath);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetStatus_should_map_outputpath_when_using_destination()
|
||||
{
|
||||
GivenSerialNumber();
|
||||
GivenTvDirectory();
|
||||
GivenSharedFolder($"/{_musicDirectory}");
|
||||
|
||||
var status = Subject.GetStatus();
|
||||
|
||||
status.OutputRootFolders.First().Should().Be(_physicalPath);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetStatus_should_map_outputpath_when_using_category()
|
||||
{
|
||||
GivenSerialNumber();
|
||||
GivenMusicCategory();
|
||||
GivenSharedFolder($"/somepath/{_category}");
|
||||
|
||||
var status = Subject.GetStatus();
|
||||
|
||||
status.OutputRootFolders.First().Should().Be(_physicalPath);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetItems_should_not_map_outputpath_for_queued_or_downloading_tasks()
|
||||
|
||||
Reference in New Issue
Block a user