New: Added global Remote Path mapping table to replace individual Local Category Path settings.

This commit is contained in:
Taloth Saldono
2014-09-11 22:24:00 +02:00
parent 8281063698
commit 525f1aa9dd
36 changed files with 904 additions and 137 deletions
@@ -11,6 +11,8 @@ using NzbDrone.Core.Parser;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Download;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.RemotePathMappings;
using NzbDrone.Common.Disk;
namespace NzbDrone.Core.Test.Download.DownloadClientTests
{
@@ -29,13 +31,15 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests
Mocker.GetMock<IParsingService>()
.Setup(s => s.Map(It.IsAny<ParsedEpisodeInfo>(), It.IsAny<int>(), null))
.Returns(CreateRemoteEpisode());
.Returns(() => CreateRemoteEpisode());
Mocker.GetMock<IHttpClient>()
.Setup(s => s.Get(It.IsAny<HttpRequest>()))
.Returns<HttpRequest>(r => new HttpResponse(r, new HttpHeader(), new Byte[0]));
Mocker.GetMock<IRemotePathMappingService>()
.Setup(v => v.RemapRemoteToLocal(It.IsAny<String>(), It.IsAny<String>()))
.Returns<String, String>((h,r) => r);
}
protected virtual RemoteEpisode CreateRemoteEpisode()
@@ -13,6 +13,7 @@ using NzbDrone.Core.Download.Clients.Nzbget;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Test.Common;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Core.RemotePathMappings;
namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetTests
{
@@ -92,11 +93,6 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetTests
.Returns(configItems);
}
protected void GivenMountPoint(String mountPath)
{
(Subject.Definition.Settings as NzbgetSettings).TvCategoryLocalPath = mountPath;
}
protected void GivenFailedDownload()
{
Mocker.GetMock<INzbgetProxy>()
@@ -251,7 +247,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetTests
[Test]
public void should_return_status_with_mounted_outputdir()
{
GivenMountPoint(@"O:\mymount".AsOsAgnostic());
Mocker.GetMock<IRemotePathMappingService>()
.Setup(v => v.RemapRemoteToLocal("127.0.0.1", "/remote/mount/tv"))
.Returns(@"O:\mymount".AsOsAgnostic());
var result = Subject.GetStatus();
@@ -263,7 +261,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetTests
[Test]
public void should_remap_storage_if_mounted()
{
GivenMountPoint(@"O:\mymount".AsOsAgnostic());
Mocker.GetMock<IRemotePathMappingService>()
.Setup(v => v.RemapRemoteToLocal("127.0.0.1", "/remote/mount/tv/Droned.S01E01.Pilot.1080p.WEB-DL-DRONE"))
.Returns(@"O:\mymount\Droned.S01E01.Pilot.1080p.WEB-DL-DRONE".AsOsAgnostic());
GivenQueue(null);
GivenHistory(_completed);
@@ -14,6 +14,7 @@ using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Core.Tv;
using NzbDrone.Test.Common;
using NzbDrone.Core.RemotePathMappings;
namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
{
@@ -106,11 +107,6 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
.Returns(_config);
}
protected void GivenMountPoint(String mountPath)
{
(Subject.Definition.Settings as SabnzbdSettings).TvCategoryLocalPath = mountPath;
}
protected void GivenFailedDownload()
{
Mocker.GetMock<ISabnzbdProxy>()
@@ -303,7 +299,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
[Test]
public void should_remap_storage_if_mounted()
{
GivenMountPoint(@"O:\mymount".AsOsAgnostic());
Mocker.GetMock<IRemotePathMappingService>()
.Setup(v => v.RemapRemoteToLocal("127.0.0.1", "/remote/mount/vv/Droned.S01E01.Pilot.1080p.WEB-DL-DRONE"))
.Returns(@"O:\mymount\Droned.S01E01.Pilot.1080p.WEB-DL-DRONE".AsOsAgnostic());
GivenQueue(null);
GivenHistory(_completed);
@@ -361,7 +359,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
[Test]
public void should_return_status_with_mounted_outputdir()
{
GivenMountPoint(@"O:\mymount".AsOsAgnostic());
Mocker.GetMock<IRemotePathMappingService>()
.Setup(v => v.RemapRemoteToLocal("127.0.0.1", "/remote/mount/vv"))
.Returns(@"O:\mymount".AsOsAgnostic());
GivenQueue(null);