1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-26 01:38:24 +00:00

more linux fixes

This commit is contained in:
kay.one 2013-07-25 22:29:59 -07:00
parent 23b2c9eef5
commit b06a58966e
5 changed files with 27 additions and 34 deletions

View file

@ -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)
{
LinuxOnly();

View file

@ -17,15 +17,18 @@ public class PneumaticProviderFixture : CoreTest<PneumaticClient>
{
private const string _nzbUrl = "http://www.nzbs.com/url";
private const string _title = "30.Rock.S01E05.hdtv.xvid-LoL";
private const string _pneumaticFolder = @"d:\nzb\pneumatic\";
private const string _sabDrop = @"d:\unsorted tv\";
private string _pneumaticFolder;
private string _sabDrop;
private string _nzbPath;
private RemoteEpisode _remoteEpisode;
[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.DownloadedEpisodesFolder).Returns(_sabDrop);
@ -54,7 +57,7 @@ public void should_download_file_if_it_doesnt_exist()
{
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]

View file

@ -20,16 +20,12 @@ namespace NzbDrone.Core.Test.MediaFileTests
[TestFixture]
public class DropFolderImportServiceFixture : CoreTest<DownloadedEpisodesImportService>
{
private EpisodeFile _fakeEpisodeFile;
private string[] _subFolders = new[] { "c:\\root\\foldername" };
private string[] _videoFiles = new[] { "c:\\root\\foldername\\video.ext" };
private string[] _subFolders = new[] { "c:\\root\\foldername".AsOsAgnostic() };
private string[] _videoFiles = new[] { "c:\\root\\foldername\\video.ext".AsOsAgnostic() };
[SetUp]
public void Setup()
{
_fakeEpisodeFile = Builder<EpisodeFile>.CreateNew().Build();
Mocker.GetMock<IDiskScanService>().Setup(c => c.GetVideoFiles(It.IsAny<string>(), It.IsAny<bool>()))
.Returns(_videoFiles);
@ -40,7 +36,7 @@ public void Setup()
.Returns(true);
Mocker.GetMock<IConfigService>().SetupGet(c => c.DownloadedEpisodesFolder)
.Returns("c:\\drop\\");
.Returns("c:\\drop\\".AsOsAgnostic());
Mocker.GetMock<IImportApprovedEpisodes>()
.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)
{
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>()
.Setup(c => c.GetDirectories(It.IsAny<string>()))

View file

@ -5,6 +5,7 @@
using NzbDrone.Core.Organizer;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.OrganizerTests
{
@ -12,19 +13,11 @@ namespace NzbDrone.Core.Test.OrganizerTests
public class BuildFilePathFixture : CoreTest<FileNameBuilder>
{
private Series _series;
private NamingConfig namingConfig;
[SetUp]
public void Setup()
{
_series = Builder<Series>
.CreateNew()
.With(s => s.Title = "South Park")
.Build();
namingConfig = new NamingConfig();
@ -42,13 +35,13 @@ public void CalculateFilePath_SeasonFolder_SingleNumber(string filename, int sea
{
var fakeSeries = Builder<Series>.CreateNew()
.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)
.Build();
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());
}
}
}

View file

@ -8,6 +8,7 @@
using NzbDrone.Core.Configuration;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.ProviderTests.RecycleBinProviderTests
{
@ -17,7 +18,7 @@ public class DeleteDirectoryFixture : CoreTest
{
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()
@ -30,7 +31,7 @@ public void should_use_delete_when_recycleBin_is_not_configured()
{
WithoutRecycleBin();
var path = @"C:\Test\TV\30 Rock";
var path = @"C:\Test\TV\30 Rock".AsOsAgnostic();
Mocker.Resolve<RecycleBinProvider>().DeleteFolder(path);
@ -42,11 +43,11 @@ public void should_use_move_when_recycleBin_is_configured()
{
WithRecycleBin();
var path = @"C:\Test\TV\30 Rock";
var path = @"C:\Test\TV\30 Rock".AsOsAgnostic();
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]
@ -54,21 +55,21 @@ public void should_call_directorySetLastWriteTime()
{
WithRecycleBin();
var path = @"C:\Test\TV\30 Rock";
var path = @"C:\Test\TV\30 Rock".AsOsAgnostic();
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]
public void should_call_fileSetLastWriteTime_for_each_file()
{
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))
.Returns(new[]{ "File1", "File2", "File3" });
Mocker.GetMock<IDiskProvider>().Setup(s => s.GetFiles(@"C:\Test\Recycle Bin\30 Rock".AsOsAgnostic(), SearchOption.AllDirectories))
.Returns(new[] { "File1", "File2", "File3" });
Mocker.Resolve<RecycleBinProvider>().DeleteFolder(path);