mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-10 21:12:56 +01:00
DiskScanProvider.Scan() will log a warning if the path doesn't exist.
This commit is contained in:
parent
0cce31cbc8
commit
bb5febaade
@ -14,7 +14,6 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||
// ReSharper disable InconsistentNaming
|
||||
public class DiskScanProviderTest : TestBase
|
||||
{
|
||||
|
||||
[Test]
|
||||
public void scan_series_should_update_last_scan_date()
|
||||
{
|
||||
@ -38,7 +37,6 @@ public void scan_series_should_update_last_scan_date()
|
||||
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void cleanup_should_skip_existing_files()
|
||||
{
|
||||
@ -89,7 +87,6 @@ public void cleanup_should_delete_none_existing_files()
|
||||
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void cleanup_should_delete_none_existing_files_remove_links_to_episodes()
|
||||
{
|
||||
@ -131,7 +128,34 @@ public void cleanup_should_delete_none_existing_files_remove_links_to_episodes()
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void scan_series_should_log_warning_if_path_doesnt_exist_on_disk()
|
||||
{
|
||||
//Setup
|
||||
var mocker = new AutoMoqer(MockBehavior.Strict);
|
||||
|
||||
var series = Builder<Series>.CreateNew()
|
||||
.With(s => s.Path = @"C:\Test\TV\SeriesName\")
|
||||
.Build();
|
||||
|
||||
mocker.GetMock<MediaFileProvider>()
|
||||
.Setup(c => c.DeleteOrphaned())
|
||||
.Returns(0);
|
||||
|
||||
mocker.GetMock<MediaFileProvider>()
|
||||
.Setup(c => c.RepairLinks())
|
||||
.Returns(0);
|
||||
|
||||
mocker.GetMock<DiskProvider>()
|
||||
.Setup(c => c.FolderExists(series.Path))
|
||||
.Returns(false);
|
||||
|
||||
//Act
|
||||
mocker.Resolve<DiskScanProvider>().Scan(series, series.Path);
|
||||
|
||||
//Assert
|
||||
mocker.VerifyAllMocks();
|
||||
ExceptionVerification.ExcpectedWarns(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -58,6 +58,12 @@ public virtual List<EpisodeFile> Scan(Series series, string path)
|
||||
_mediaFileProvider.DeleteOrphaned();
|
||||
_mediaFileProvider.RepairLinks();
|
||||
|
||||
if (!_diskProvider.FolderExists(path))
|
||||
{
|
||||
Logger. Warn("Series folder doesn't exist: {0}", path);
|
||||
return new List<EpisodeFile>();
|
||||
}
|
||||
|
||||
if (_episodeProvider.GetEpisodeBySeries(series.SeriesId).Count == 0)
|
||||
{
|
||||
Logger.Debug("Series {0} has no episodes. skipping", series.Title);
|
||||
|
Loading…
Reference in New Issue
Block a user