1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-09 04:22:30 +01:00

Create series folder when it doesn't exist

This commit is contained in:
Mark McDowall 2013-03-21 08:36:22 -07:00
parent 05c7b4f4ef
commit 9af5dbdc05
2 changed files with 13 additions and 4 deletions

View File

@ -421,19 +421,28 @@ public void should_process_if_free_disk_space_equals_size()
} }
[Test] [Test]
public void should_return_if_series_path_does_not_exist() public void should_create_series_directory_if_series_path_does_not_exist()
{ {
var downloadName = new DirectoryInfo(@"C:\Test\Drop\30.Rock.S01E01.Pilot"); var downloadName = new DirectoryInfo(@"C:\Test\Drop\30.Rock.S01E01.Pilot");
WithValidSeries(); WithValidSeries();
WithLotsOfFreeDiskSpace();
WithImportedFiles(downloadName.FullName);
Mocker.GetMock<DiskProvider>() Mocker.GetMock<DiskProvider>()
.Setup(s => s.FolderExists(fakeSeries.Path)) .Setup(s => s.FolderExists(fakeSeries.Path))
.Returns(false); .Returns(false);
Mocker.GetMock<ISeriesRepository>().Setup(s => s.GetByTitle("office")).Returns(fakeSeries);
Mocker.GetMock<DiskScanProvider>().Setup(s => s.CleanUpDropFolder(downloadName.FullName));
Mocker.GetMock<IMoveEpisodeFiles>().Setup(s => s.MoveEpisodeFile(It.IsAny<EpisodeFile>(), true)).Returns(new EpisodeFile());
Mocker.GetMock<DiskProvider>().Setup(s => s.GetDirectorySize(downloadName.FullName)).Returns(Constants.IgnoreFileSize - 1.Megabytes());
Mocker.GetMock<DiskProvider>().Setup(s => s.DeleteFolder(downloadName.FullName, true));
Mocker.GetMock<DiskProvider>().Setup(s => s.IsFolderLocked(downloadName.FullName)).Returns(false);
Mocker.Resolve<PostDownloadProvider>().ProcessDownload(downloadName); Mocker.Resolve<PostDownloadProvider>().ProcessDownload(downloadName);
Mocker.GetMock<DiskProvider>().Verify(c => c.GetDirectorySize(It.IsAny<String>()), Times.Never()); Mocker.GetMock<DiskProvider>().Verify(c => c.CreateDirectory(fakeSeries.Path), Times.Once());
ExceptionVerification.ExpectedWarns(1); ExceptionVerification.ExpectedWarns(1);
} }

View File

@ -88,8 +88,8 @@ public virtual void ProcessDownload(DirectoryInfo subfolderInfo)
if (!_diskProvider.FolderExists(series.Path)) if (!_diskProvider.FolderExists(series.Path))
{ {
Logger.Warn("Series Folder doesn't exist: {0}", series.Path); Logger.Warn("Series Folder doesn't exist: {0}, creating it", series.Path);
return; _diskProvider.CreateDirectory(series.Path);
} }
var size = _diskProvider.GetDirectorySize(subfolderInfo.FullName); var size = _diskProvider.GetDirectorySize(subfolderInfo.FullName);