mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-21 22:04:31 -04:00
Cleanup Conflicts in Sonarr/Lidarr Pulls
Co-Authored-By: Robin Dadswell <19610103+RobinDadswell@users.noreply.github.com>
This commit is contained in:
@@ -49,19 +49,19 @@ namespace NzbDrone.Core.Test.MetadataSource.Goodreads
|
||||
{
|
||||
var details = Subject.GetBookInfo(mbId);
|
||||
|
||||
ValidateAlbums(new List<Book> { details.Item2 });
|
||||
ValidateBooks(new List<Book> { details.Item2 });
|
||||
|
||||
details.Item2.Title.Should().Be(name);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void getting_details_of_invalid_artist()
|
||||
public void getting_details_of_invalid_author()
|
||||
{
|
||||
Assert.Throws<AuthorNotFoundException>(() => Subject.GetAuthorInfo("66c66aaa-6e2f-4930-8610-912e24c63ed1"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void getting_details_of_invalid_album()
|
||||
public void getting_details_of_invalid_book()
|
||||
{
|
||||
Assert.Throws<BookNotFoundException>(() => Subject.GetBookInfo("66c66aaa-6e2f-4930-8610-912e24c63ed1"));
|
||||
}
|
||||
@@ -78,37 +78,37 @@ namespace NzbDrone.Core.Test.MetadataSource.Goodreads
|
||||
author.ForeignAuthorId.Should().NotBeNullOrWhiteSpace();
|
||||
}
|
||||
|
||||
private void ValidateAlbums(List<Book> albums, bool idOnly = false)
|
||||
private void ValidateBooks(List<Book> books, bool idOnly = false)
|
||||
{
|
||||
albums.Should().NotBeEmpty();
|
||||
books.Should().NotBeEmpty();
|
||||
|
||||
foreach (var album in albums)
|
||||
foreach (var book in books)
|
||||
{
|
||||
album.ForeignBookId.Should().NotBeNullOrWhiteSpace();
|
||||
book.ForeignBookId.Should().NotBeNullOrWhiteSpace();
|
||||
if (!idOnly)
|
||||
{
|
||||
ValidateAlbum(album);
|
||||
ValidateBook(book);
|
||||
}
|
||||
}
|
||||
|
||||
//if atleast one album has title it means parse it working.
|
||||
//if atleast one book has title it means parse it working.
|
||||
if (!idOnly)
|
||||
{
|
||||
albums.Should().Contain(c => !string.IsNullOrWhiteSpace(c.Title));
|
||||
books.Should().Contain(c => !string.IsNullOrWhiteSpace(c.Title));
|
||||
}
|
||||
}
|
||||
|
||||
private void ValidateAlbum(Book album)
|
||||
private void ValidateBook(Book book)
|
||||
{
|
||||
album.Should().NotBeNull();
|
||||
book.Should().NotBeNull();
|
||||
|
||||
album.Title.Should().NotBeNullOrWhiteSpace();
|
||||
book.Title.Should().NotBeNullOrWhiteSpace();
|
||||
|
||||
album.Should().NotBeNull();
|
||||
book.Should().NotBeNull();
|
||||
|
||||
if (album.ReleaseDate.HasValue)
|
||||
if (book.ReleaseDate.HasValue)
|
||||
{
|
||||
album.ReleaseDate.Value.Kind.Should().Be(DateTimeKind.Utc);
|
||||
book.ReleaseDate.Value.Kind.Should().Be(DateTimeKind.Utc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace NzbDrone.Core.Test.MetadataSource.Goodreads
|
||||
[TestCase("Robert Harris", "Robert Harris")]
|
||||
[TestCase("James Patterson", "James Patterson")]
|
||||
[TestCase("Antoine de Saint-Exupéry", "Antoine de Saint-Exupéry")]
|
||||
public void successful_artist_search(string title, string expected)
|
||||
public void successful_author_search(string title, string expected)
|
||||
{
|
||||
var result = Subject.SearchForNewAuthor(title);
|
||||
|
||||
@@ -51,9 +51,9 @@ namespace NzbDrone.Core.Test.MetadataSource.Goodreads
|
||||
[TestCase("goodreads:3", null, "Harry Potter and the Philosopher's Stone")]
|
||||
[TestCase("asin:B0192CTMYG", null, "Harry Potter and the Sorcerer's Stone")]
|
||||
[TestCase("isbn:9780439554930", null, "Harry Potter and the Sorcerer's Stone")]
|
||||
public void successful_album_search(string title, string artist, string expected)
|
||||
public void successful_book_search(string title, string author, string expected)
|
||||
{
|
||||
var result = Subject.SearchForNewBook(title, artist);
|
||||
var result = Subject.SearchForNewBook(title, author);
|
||||
|
||||
result.Should().NotBeEmpty();
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace NzbDrone.Core.Test.MetadataSource.Goodreads
|
||||
[TestCase("readarrid: -12")]
|
||||
[TestCase("readarrid: aaaa")]
|
||||
[TestCase("adjalkwdjkalwdjklawjdlKAJD")]
|
||||
public void no_artist_search_result(string term)
|
||||
public void no_author_search_result(string term)
|
||||
{
|
||||
var result = Subject.SearchForNewAuthor(term);
|
||||
result.Should().BeEmpty();
|
||||
|
||||
@@ -9,19 +9,19 @@ using NzbDrone.Core.Test.Framework;
|
||||
namespace NzbDrone.Core.Test.MetadataSource
|
||||
{
|
||||
[TestFixture]
|
||||
public class SearchArtistComparerFixture : CoreTest
|
||||
public class SearchAuthorComparerFixture : CoreTest
|
||||
{
|
||||
private List<Author> _artist;
|
||||
private List<Author> _author;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_artist = new List<Author>();
|
||||
_author = new List<Author>();
|
||||
}
|
||||
|
||||
private void WithSeries(string name)
|
||||
{
|
||||
_artist.Add(new Author { Name = name });
|
||||
_author.Add(new Author { Name = name });
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -30,9 +30,9 @@ namespace NzbDrone.Core.Test.MetadataSource
|
||||
WithSeries("Talking Dead");
|
||||
WithSeries("The Walking Dead");
|
||||
|
||||
_artist.Sort(new SearchAuthorComparer("the walking dead"));
|
||||
_author.Sort(new SearchAuthorComparer("the walking dead"));
|
||||
|
||||
_artist.First().Name.Should().Be("The Walking Dead");
|
||||
_author.First().Name.Should().Be("The Walking Dead");
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -41,9 +41,9 @@ namespace NzbDrone.Core.Test.MetadataSource
|
||||
WithSeries("Talking Dead");
|
||||
WithSeries("The Walking Dead");
|
||||
|
||||
_artist.Sort(new SearchAuthorComparer("walking dead"));
|
||||
_author.Sort(new SearchAuthorComparer("walking dead"));
|
||||
|
||||
_artist.First().Name.Should().Be("The Walking Dead");
|
||||
_author.First().Name.Should().Be("The Walking Dead");
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -52,9 +52,9 @@ namespace NzbDrone.Core.Test.MetadataSource
|
||||
WithSeries("The Blacklist");
|
||||
WithSeries("Blacklist");
|
||||
|
||||
_artist.Sort(new SearchAuthorComparer("blacklist"));
|
||||
_author.Sort(new SearchAuthorComparer("blacklist"));
|
||||
|
||||
_artist.First().Name.Should().Be("Blacklist");
|
||||
_author.First().Name.Should().Be("Blacklist");
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -63,9 +63,9 @@ namespace NzbDrone.Core.Test.MetadataSource
|
||||
WithSeries("Blacklist");
|
||||
WithSeries("The Blacklist");
|
||||
|
||||
_artist.Sort(new SearchAuthorComparer("the blacklist"));
|
||||
_author.Sort(new SearchAuthorComparer("the blacklist"));
|
||||
|
||||
_artist.First().Name.Should().Be("The Blacklist");
|
||||
_author.First().Name.Should().Be("The Blacklist");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user