mirror of
https://github.com/Radarr/Radarr
synced 2024-12-26 01:38:24 +00:00
more linux fixes
This commit is contained in:
parent
23b2c9eef5
commit
b06a58966e
5 changed files with 27 additions and 34 deletions
|
@ -16,7 +16,7 @@ public void EnsureWindowsPath(string path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[TestCase(@"var/user/file with, comma.mkv")]
|
[TestCase(@"/var/user/file with, comma.mkv")]
|
||||||
public void EnsureLinuxPath(string path)
|
public void EnsureLinuxPath(string path)
|
||||||
{
|
{
|
||||||
LinuxOnly();
|
LinuxOnly();
|
||||||
|
|
|
@ -17,15 +17,18 @@ public class PneumaticProviderFixture : CoreTest<PneumaticClient>
|
||||||
{
|
{
|
||||||
private const string _nzbUrl = "http://www.nzbs.com/url";
|
private const string _nzbUrl = "http://www.nzbs.com/url";
|
||||||
private const string _title = "30.Rock.S01E05.hdtv.xvid-LoL";
|
private const string _title = "30.Rock.S01E05.hdtv.xvid-LoL";
|
||||||
private const string _pneumaticFolder = @"d:\nzb\pneumatic\";
|
private string _pneumaticFolder;
|
||||||
private const string _sabDrop = @"d:\unsorted tv\";
|
private string _sabDrop;
|
||||||
private string _nzbPath;
|
private string _nzbPath;
|
||||||
private RemoteEpisode _remoteEpisode;
|
private RemoteEpisode _remoteEpisode;
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
_nzbPath = _pneumaticFolder + _title + ".nzb";
|
_pneumaticFolder = @"d:\nzb\pneumatic\".AsOsAgnostic();
|
||||||
|
|
||||||
|
_nzbPath = Path.Combine(_pneumaticFolder, _title + ".nzb").AsOsAgnostic();
|
||||||
|
_sabDrop = @"d:\unsorted tv\".AsOsAgnostic();
|
||||||
|
|
||||||
Mocker.GetMock<IConfigService>().SetupGet(c => c.PneumaticFolder).Returns(_pneumaticFolder);
|
Mocker.GetMock<IConfigService>().SetupGet(c => c.PneumaticFolder).Returns(_pneumaticFolder);
|
||||||
Mocker.GetMock<IConfigService>().SetupGet(c => c.DownloadedEpisodesFolder).Returns(_sabDrop);
|
Mocker.GetMock<IConfigService>().SetupGet(c => c.DownloadedEpisodesFolder).Returns(_sabDrop);
|
||||||
|
@ -54,7 +57,7 @@ public void should_download_file_if_it_doesnt_exist()
|
||||||
{
|
{
|
||||||
Subject.DownloadNzb(_remoteEpisode).Should().BeTrue();
|
Subject.DownloadNzb(_remoteEpisode).Should().BeTrue();
|
||||||
|
|
||||||
Mocker.GetMock<IHttpProvider>().Verify(c => c.DownloadFile(_nzbUrl, _nzbPath),Times.Once());
|
Mocker.GetMock<IHttpProvider>().Verify(c => c.DownloadFile(_nzbUrl, _nzbPath), Times.Once());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -73,7 +76,7 @@ public void should_return_false_on_failed_download()
|
||||||
WithFailedDownload();
|
WithFailedDownload();
|
||||||
|
|
||||||
Subject.DownloadNzb(_remoteEpisode).Should().BeFalse();
|
Subject.DownloadNzb(_remoteEpisode).Should().BeFalse();
|
||||||
|
|
||||||
ExceptionVerification.ExpectedWarns(1);
|
ExceptionVerification.ExpectedWarns(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,16 +20,12 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class DropFolderImportServiceFixture : CoreTest<DownloadedEpisodesImportService>
|
public class DropFolderImportServiceFixture : CoreTest<DownloadedEpisodesImportService>
|
||||||
{
|
{
|
||||||
private EpisodeFile _fakeEpisodeFile;
|
private string[] _subFolders = new[] { "c:\\root\\foldername".AsOsAgnostic() };
|
||||||
|
private string[] _videoFiles = new[] { "c:\\root\\foldername\\video.ext".AsOsAgnostic() };
|
||||||
private string[] _subFolders = new[] { "c:\\root\\foldername" };
|
|
||||||
private string[] _videoFiles = new[] { "c:\\root\\foldername\\video.ext" };
|
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
_fakeEpisodeFile = Builder<EpisodeFile>.CreateNew().Build();
|
|
||||||
|
|
||||||
Mocker.GetMock<IDiskScanService>().Setup(c => c.GetVideoFiles(It.IsAny<string>(), It.IsAny<bool>()))
|
Mocker.GetMock<IDiskScanService>().Setup(c => c.GetVideoFiles(It.IsAny<string>(), It.IsAny<bool>()))
|
||||||
.Returns(_videoFiles);
|
.Returns(_videoFiles);
|
||||||
|
|
||||||
|
@ -40,7 +36,7 @@ public void Setup()
|
||||||
.Returns(true);
|
.Returns(true);
|
||||||
|
|
||||||
Mocker.GetMock<IConfigService>().SetupGet(c => c.DownloadedEpisodesFolder)
|
Mocker.GetMock<IConfigService>().SetupGet(c => c.DownloadedEpisodesFolder)
|
||||||
.Returns("c:\\drop\\");
|
.Returns("c:\\drop\\".AsOsAgnostic());
|
||||||
|
|
||||||
Mocker.GetMock<IImportApprovedEpisodes>()
|
Mocker.GetMock<IImportApprovedEpisodes>()
|
||||||
.Setup(s => s.Import(It.IsAny<List<ImportDecision>>(), true))
|
.Setup(s => s.Import(It.IsAny<List<ImportDecision>>(), true))
|
||||||
|
@ -146,7 +142,7 @@ public void should_delete_folder_if_files_were_imported()
|
||||||
public void should_remove_unpack_from_folder_name(string prefix)
|
public void should_remove_unpack_from_folder_name(string prefix)
|
||||||
{
|
{
|
||||||
var folderName = "30.rock.s01e01.pilot.hdtv-lol";
|
var folderName = "30.rock.s01e01.pilot.hdtv-lol";
|
||||||
var folders = new[] { String.Format(@"C:\Test\Unsorted\{0}{1}", prefix, folderName) };
|
var folders = new[] { String.Format(@"C:\Test\Unsorted\{0}{1}", prefix, folderName).AsOsAgnostic() };
|
||||||
|
|
||||||
Mocker.GetMock<IDiskProvider>()
|
Mocker.GetMock<IDiskProvider>()
|
||||||
.Setup(c => c.GetDirectories(It.IsAny<string>()))
|
.Setup(c => c.GetDirectories(It.IsAny<string>()))
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
using NzbDrone.Core.Organizer;
|
using NzbDrone.Core.Organizer;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
using NzbDrone.Test.Common;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.OrganizerTests
|
namespace NzbDrone.Core.Test.OrganizerTests
|
||||||
{
|
{
|
||||||
|
@ -12,19 +13,11 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
||||||
|
|
||||||
public class BuildFilePathFixture : CoreTest<FileNameBuilder>
|
public class BuildFilePathFixture : CoreTest<FileNameBuilder>
|
||||||
{
|
{
|
||||||
private Series _series;
|
|
||||||
|
|
||||||
private NamingConfig namingConfig;
|
private NamingConfig namingConfig;
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
_series = Builder<Series>
|
|
||||||
.CreateNew()
|
|
||||||
.With(s => s.Title = "South Park")
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
|
|
||||||
namingConfig = new NamingConfig();
|
namingConfig = new NamingConfig();
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,13 +35,13 @@ public void CalculateFilePath_SeasonFolder_SingleNumber(string filename, int sea
|
||||||
{
|
{
|
||||||
var fakeSeries = Builder<Series>.CreateNew()
|
var fakeSeries = Builder<Series>.CreateNew()
|
||||||
.With(s => s.Title = "30 Rock")
|
.With(s => s.Title = "30 Rock")
|
||||||
.With(s => s.Path = @"C:\Test\30 Rock")
|
.With(s => s.Path = @"C:\Test\30 Rock".AsOsAgnostic())
|
||||||
.With(s => s.SeasonFolder = useSeasonFolder)
|
.With(s => s.SeasonFolder = useSeasonFolder)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
Mocker.GetMock<IConfigService>().Setup(e => e.SeasonFolderFormat).Returns(seasonFolderFormat);
|
Mocker.GetMock<IConfigService>().Setup(e => e.SeasonFolderFormat).Returns(seasonFolderFormat);
|
||||||
|
|
||||||
Subject.BuildFilePath(fakeSeries, 1, filename, ".mkv").Should().Be(expectedPath);
|
Subject.BuildFilePath(fakeSeries, 1, filename, ".mkv").Should().Be(expectedPath.AsOsAgnostic());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,16 +8,17 @@
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.MediaFiles;
|
using NzbDrone.Core.MediaFiles;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
using NzbDrone.Test.Common;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.ProviderTests.RecycleBinProviderTests
|
namespace NzbDrone.Core.Test.ProviderTests.RecycleBinProviderTests
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
|
|
||||||
public class DeleteDirectoryFixture : CoreTest
|
public class DeleteDirectoryFixture : CoreTest
|
||||||
{
|
{
|
||||||
private void WithRecycleBin()
|
private void WithRecycleBin()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<IConfigService>().SetupGet(s => s.RecycleBin).Returns(@"C:\Test\Recycle Bin");
|
Mocker.GetMock<IConfigService>().SetupGet(s => s.RecycleBin).Returns(@"C:\Test\Recycle Bin".AsOsAgnostic());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WithoutRecycleBin()
|
private void WithoutRecycleBin()
|
||||||
|
@ -30,7 +31,7 @@ public void should_use_delete_when_recycleBin_is_not_configured()
|
||||||
{
|
{
|
||||||
WithoutRecycleBin();
|
WithoutRecycleBin();
|
||||||
|
|
||||||
var path = @"C:\Test\TV\30 Rock";
|
var path = @"C:\Test\TV\30 Rock".AsOsAgnostic();
|
||||||
|
|
||||||
Mocker.Resolve<RecycleBinProvider>().DeleteFolder(path);
|
Mocker.Resolve<RecycleBinProvider>().DeleteFolder(path);
|
||||||
|
|
||||||
|
@ -42,11 +43,11 @@ public void should_use_move_when_recycleBin_is_configured()
|
||||||
{
|
{
|
||||||
WithRecycleBin();
|
WithRecycleBin();
|
||||||
|
|
||||||
var path = @"C:\Test\TV\30 Rock";
|
var path = @"C:\Test\TV\30 Rock".AsOsAgnostic();
|
||||||
|
|
||||||
Mocker.Resolve<RecycleBinProvider>().DeleteFolder(path);
|
Mocker.Resolve<RecycleBinProvider>().DeleteFolder(path);
|
||||||
|
|
||||||
Mocker.GetMock<IDiskProvider>().Verify(v => v.MoveFolder(path, @"C:\Test\Recycle Bin\30 Rock"), Times.Once());
|
Mocker.GetMock<IDiskProvider>().Verify(v => v.MoveFolder(path, @"C:\Test\Recycle Bin\30 Rock".AsOsAgnostic()), Times.Once());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -54,21 +55,21 @@ public void should_call_directorySetLastWriteTime()
|
||||||
{
|
{
|
||||||
WithRecycleBin();
|
WithRecycleBin();
|
||||||
|
|
||||||
var path = @"C:\Test\TV\30 Rock";
|
var path = @"C:\Test\TV\30 Rock".AsOsAgnostic();
|
||||||
|
|
||||||
Mocker.Resolve<RecycleBinProvider>().DeleteFolder(path);
|
Mocker.Resolve<RecycleBinProvider>().DeleteFolder(path);
|
||||||
|
|
||||||
Mocker.GetMock<IDiskProvider>().Verify(v => v.FolderSetLastWriteTimeUtc(@"C:\Test\Recycle Bin\30 Rock", It.IsAny<DateTime>()), Times.Once());
|
Mocker.GetMock<IDiskProvider>().Verify(v => v.FolderSetLastWriteTimeUtc(@"C:\Test\Recycle Bin\30 Rock".AsOsAgnostic(), It.IsAny<DateTime>()), Times.Once());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_call_fileSetLastWriteTime_for_each_file()
|
public void should_call_fileSetLastWriteTime_for_each_file()
|
||||||
{
|
{
|
||||||
WithRecycleBin();
|
WithRecycleBin();
|
||||||
var path = @"C:\Test\TV\30 Rock";
|
var path = @"C:\Test\TV\30 Rock".AsOsAgnostic();
|
||||||
|
|
||||||
Mocker.GetMock<IDiskProvider>().Setup(s => s.GetFiles(@"C:\Test\Recycle Bin\30 Rock", SearchOption.AllDirectories))
|
Mocker.GetMock<IDiskProvider>().Setup(s => s.GetFiles(@"C:\Test\Recycle Bin\30 Rock".AsOsAgnostic(), SearchOption.AllDirectories))
|
||||||
.Returns(new[]{ "File1", "File2", "File3" });
|
.Returns(new[] { "File1", "File2", "File3" });
|
||||||
|
|
||||||
Mocker.Resolve<RecycleBinProvider>().DeleteFolder(path);
|
Mocker.Resolve<RecycleBinProvider>().DeleteFolder(path);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue