mirror of https://github.com/lidarr/Lidarr
Drone factory would throw exception on unknown series instead of proper error.
This commit is contained in:
parent
374fe07aba
commit
5fed3670c8
|
@ -16,6 +16,7 @@ using NzbDrone.Core.Qualities;
|
|||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Test.Common;
|
||||
using FluentAssertions;
|
||||
|
||||
namespace NzbDrone.Core.Test.MediaFiles
|
||||
{
|
||||
|
@ -195,6 +196,20 @@ namespace NzbDrone.Core.Test.MediaFiles
|
|||
.Verify(v => v.GetSeries(It.Is<String>(s => s.StartsWith(prefix))), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_importresult_on_unknown_series()
|
||||
{
|
||||
var fileName = @"C:\folder\file.mkv".AsOsAgnostic();
|
||||
|
||||
var result = Subject.ProcessFile(new FileInfo(fileName));
|
||||
|
||||
result.Should().HaveCount(1);
|
||||
result.First().ImportDecision.Should().NotBeNull();
|
||||
result.First().ImportDecision.LocalEpisode.Should().NotBeNull();
|
||||
result.First().ImportDecision.LocalEpisode.Path.Should().Be(fileName);
|
||||
result.First().Result.Should().Be(ImportResultType.Rejected);
|
||||
}
|
||||
|
||||
private void VerifyNoImport()
|
||||
{
|
||||
Mocker.GetMock<IImportApprovedEpisodes>().Verify(c => c.Import(It.IsAny<List<ImportDecision>>(), true, null),
|
||||
|
|
|
@ -132,7 +132,7 @@ namespace NzbDrone.Core.MediaFiles
|
|||
if (series == null)
|
||||
{
|
||||
_logger.Debug("Unknown Series for file: {0}", fileInfo.Name);
|
||||
return new List<ImportResult>() { new ImportResult(null, String.Format("Unknown Series for file: {0}", fileInfo.Name)) };
|
||||
return new List<ImportResult>() { new ImportResult(new ImportDecision(new LocalEpisode { Path = fileInfo.FullName }, "Unknown Series"), String.Format("Unknown Series for file: {0}", fileInfo.Name)) };
|
||||
}
|
||||
|
||||
if (_diskProvider.IsFileLocked(fileInfo.FullName))
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.EnsureThat;
|
||||
|
||||
namespace NzbDrone.Core.MediaFiles.EpisodeImport
|
||||
{
|
||||
|
@ -27,6 +28,8 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
|
|||
|
||||
public ImportResult(ImportDecision importDecision, params String[] errors)
|
||||
{
|
||||
Ensure.That(importDecision, () => importDecision).IsNotNull();
|
||||
|
||||
ImportDecision = importDecision;
|
||||
Errors = errors.ToList();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue