Fixed: Gracefully handle Goodreads search error

Fixes #897
This commit is contained in:
ta264
2021-03-17 21:35:42 +00:00
parent 1e0e8adc77
commit acb6fc01b3
2 changed files with 44 additions and 3 deletions
@@ -0,0 +1,41 @@
using System.Collections.Generic;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using NzbDrone.Core.MediaFiles.BookImport.Identification;
using NzbDrone.Core.MetadataSource;
using NzbDrone.Core.MetadataSource.Goodreads;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.MediaFiles.BookImport.Identification
{
[TestFixture]
public class CandidateServiceFixture : CoreTest<CandidateService>
{
[Test]
public void should_not_throw_on_goodreads_exception()
{
Mocker.GetMock<ISearchForNewBook>()
.Setup(s => s.SearchForNewBook(It.IsAny<string>(), It.IsAny<string>()))
.Throws(new GoodreadsException("Bad search"));
var edition = new LocalEdition
{
LocalBooks = new List<LocalBook>
{
new LocalBook
{
FileTrackInfo = new ParsedTrackInfo
{
AuthorTitle = "Author",
BookTitle = "Book"
}
}
}
};
Subject.GetRemoteCandidates(edition).Should().BeEmpty();
}
}
}