mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-23 22:25:09 -04:00
removed trakt references, added user agent to tvdb requests
This commit is contained in:
+5
-5
@@ -9,7 +9,7 @@ using NzbDrone.Core.Tv;
|
||||
namespace NzbDrone.Core.Test.MetadataSourceTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class TraktSearchSeriesComparerFixture : CoreTest
|
||||
public class SearchSeriesComparerFixture : CoreTest
|
||||
{
|
||||
private List<Series> _series;
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace NzbDrone.Core.Test.MetadataSourceTests
|
||||
WithSeries("Talking Dead");
|
||||
WithSeries("The Walking Dead");
|
||||
|
||||
_series.Sort(new TraktSearchSeriesComparer("the walking dead"));
|
||||
_series.Sort(new SearchSeriesComparer("the walking dead"));
|
||||
|
||||
_series.First().Title.Should().Be("The Walking Dead");
|
||||
}
|
||||
@@ -41,7 +41,7 @@ namespace NzbDrone.Core.Test.MetadataSourceTests
|
||||
WithSeries("Talking Dead");
|
||||
WithSeries("The Walking Dead");
|
||||
|
||||
_series.Sort(new TraktSearchSeriesComparer("walking dead"));
|
||||
_series.Sort(new SearchSeriesComparer("walking dead"));
|
||||
|
||||
_series.First().Title.Should().Be("The Walking Dead");
|
||||
}
|
||||
@@ -52,7 +52,7 @@ namespace NzbDrone.Core.Test.MetadataSourceTests
|
||||
WithSeries("The Blacklist");
|
||||
WithSeries("Blacklist");
|
||||
|
||||
_series.Sort(new TraktSearchSeriesComparer("blacklist"));
|
||||
_series.Sort(new SearchSeriesComparer("blacklist"));
|
||||
|
||||
_series.First().Title.Should().Be("Blacklist");
|
||||
}
|
||||
@@ -63,7 +63,7 @@ namespace NzbDrone.Core.Test.MetadataSourceTests
|
||||
WithSeries("Blacklist");
|
||||
WithSeries("The Blacklist");
|
||||
|
||||
_series.Sort(new TraktSearchSeriesComparer("the blacklist"));
|
||||
_series.Sort(new SearchSeriesComparer("the blacklist"));
|
||||
|
||||
_series.First().Title.Should().Be("The Blacklist");
|
||||
}
|
||||
@@ -1,138 +0,0 @@
|
||||
/*
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.MediaCover;
|
||||
using NzbDrone.Core.MetadataSource;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Test.Common;
|
||||
using NzbDrone.Test.Common.Categories;
|
||||
|
||||
namespace NzbDrone.Core.Test.MetadataSourceTests
|
||||
{
|
||||
[TestFixture]
|
||||
[IntegrationTest]
|
||||
public class TraktProxyFixture : CoreTest<TraktProxy>
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
UseRealHttp();
|
||||
}
|
||||
|
||||
[TestCase("The Simpsons", "The Simpsons")]
|
||||
[TestCase("South Park", "South Park")]
|
||||
[TestCase("Franklin & Bash", "Franklin & Bash")]
|
||||
[TestCase("Mr. D", "Mr. D")]
|
||||
[TestCase("Rob & Big", "Rob and Big")]
|
||||
[TestCase("M*A*S*H", "M*A*S*H")]
|
||||
[TestCase("imdb:tt0436992", "Doctor Who (2005)")]
|
||||
[TestCase("tvdb:78804", "Doctor Who (2005)")]
|
||||
public void successful_search(string title, string expected)
|
||||
{
|
||||
var result = Subject.SearchForNewSeries(title);
|
||||
|
||||
result.Should().NotBeEmpty();
|
||||
|
||||
result[0].Title.Should().Be(expected);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void no_search_result()
|
||||
{
|
||||
var result = Subject.SearchForNewSeries(Guid.NewGuid().ToString());
|
||||
result.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[TestCase(75978, "Family Guy")]
|
||||
[TestCase(83462, "Castle (2009)")]
|
||||
[TestCase(266189, "The Blacklist")]
|
||||
public void should_be_able_to_get_series_detail(Int32 tvdbId, String title)
|
||||
{
|
||||
var details = Subject.GetSeriesInfo(tvdbId);
|
||||
|
||||
ValidateSeries(details.Item1);
|
||||
ValidateEpisodes(details.Item2);
|
||||
|
||||
details.Item1.Title.Should().Be(title);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void getting_details_of_invalid_series()
|
||||
{
|
||||
Assert.Throws<HttpException>(() => Subject.GetSeriesInfo(Int32.MaxValue));
|
||||
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_have_period_at_start_of_title_slug()
|
||||
{
|
||||
var details = Subject.GetSeriesInfo(79099);
|
||||
|
||||
details.Item1.TitleSlug.Should().Be("dothack");
|
||||
}
|
||||
|
||||
private void ValidateSeries(Series series)
|
||||
{
|
||||
series.Should().NotBeNull();
|
||||
series.Title.Should().NotBeNullOrWhiteSpace();
|
||||
series.CleanTitle.Should().Be(Parser.Parser.CleanSeriesTitle(series.Title));
|
||||
series.SortTitle.Should().Be(SeriesTitleNormalizer.Normalize(series.Title, series.TvdbId));
|
||||
series.Overview.Should().NotBeNullOrWhiteSpace();
|
||||
series.AirTime.Should().NotBeNullOrWhiteSpace();
|
||||
series.FirstAired.Should().HaveValue();
|
||||
series.FirstAired.Value.Kind.Should().Be(DateTimeKind.Utc);
|
||||
series.Images.Should().NotBeEmpty();
|
||||
series.ImdbId.Should().NotBeNullOrWhiteSpace();
|
||||
series.Network.Should().NotBeNullOrWhiteSpace();
|
||||
series.Runtime.Should().BeGreaterThan(0);
|
||||
series.TitleSlug.Should().NotBeNullOrWhiteSpace();
|
||||
series.TvRageId.Should().BeGreaterThan(0);
|
||||
series.TvdbId.Should().BeGreaterThan(0);
|
||||
}
|
||||
|
||||
private void ValidateEpisodes(List<Episode> episodes)
|
||||
{
|
||||
episodes.Should().NotBeEmpty();
|
||||
|
||||
var episodeGroup= episodes.GroupBy(e => e.SeasonNumber.ToString("000") + e.EpisodeNumber.ToString("000"));
|
||||
episodeGroup.Should().OnlyContain(c=>c.Count() == 1);
|
||||
|
||||
episodes.Should().Contain(c => c.SeasonNumber > 0);
|
||||
episodes.Should().Contain(c => !string.IsNullOrWhiteSpace(c.Overview));
|
||||
|
||||
foreach (var episode in episodes)
|
||||
{
|
||||
ValidateEpisode(episode);
|
||||
|
||||
//if atleast one episdoe has title it means parse it working.
|
||||
episodes.Should().Contain(c => !string.IsNullOrWhiteSpace(c.Title));
|
||||
}
|
||||
}
|
||||
|
||||
private void ValidateEpisode(Episode episode)
|
||||
{
|
||||
episode.Should().NotBeNull();
|
||||
|
||||
//TODO: Is there a better way to validate that episode number or season number is greater than zero?
|
||||
(episode.EpisodeNumber + episode.SeasonNumber).Should().NotBe(0);
|
||||
|
||||
episode.Should().NotBeNull();
|
||||
|
||||
if (episode.AirDateUtc.HasValue)
|
||||
{
|
||||
episode.AirDateUtc.Value.Kind.Should().Be(DateTimeKind.Utc);
|
||||
}
|
||||
|
||||
episode.Images.Any(i => i.CoverType == MediaCoverTypes.Screenshot && i.Url.Contains("-940."))
|
||||
.Should()
|
||||
.BeFalse();
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1,69 +0,0 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using Moq;
|
||||
//using NUnit.Framework;
|
||||
//using NzbDrone.Common.Http;
|
||||
//using NzbDrone.Core.MetadataSource;
|
||||
//using NzbDrone.Core.MetadataSource.Trakt;
|
||||
//using NzbDrone.Core.Test.Framework;
|
||||
//using NzbDrone.Test.Common;
|
||||
//
|
||||
//namespace NzbDrone.Core.Test.MetadataSourceTests
|
||||
//{
|
||||
// [TestFixture]
|
||||
// public class TraktProxyQueryFixture : CoreTest<TraktProxy>
|
||||
// {
|
||||
// [TestCase("tvdb:78804", "/78804/")]
|
||||
// [TestCase("TVDB:78804", "/78804/")]
|
||||
// [TestCase("TVDB: 78804 ", "/78804/")]
|
||||
// public void search_by_lookup(string title, string expectedPartialQuery)
|
||||
// {
|
||||
// Assert.Throws<TraktException>(() => Subject.SearchForNewSeries(title));
|
||||
//
|
||||
// Mocker.GetMock<IHttpClient>()
|
||||
// .Verify(v => v.Get<Show>(It.Is<HttpRequest>(d => d.Url.ToString().Contains(expectedPartialQuery))), Times.Once());
|
||||
//
|
||||
// ExceptionVerification.ExpectedWarns(1);
|
||||
// }
|
||||
//
|
||||
// [TestCase("imdb:tt0436992", "tt0436992")]
|
||||
// [TestCase("imdb:0436992", "tt0436992")]
|
||||
// [TestCase("IMDB:0436992", "tt0436992")]
|
||||
// [TestCase("IMDB: 0436992 ", "tt0436992")]
|
||||
//// [TestCase("The BigBangTheory", "the+bigbangtheory")]
|
||||
//// [TestCase("TheBigBangTheory", "the+big+bang+theory")]
|
||||
//// [TestCase(" TheBigBangTheory", "the+big+bang+theory")]
|
||||
// [TestCase("Agents of S.H.I.E.L.D.", "agents+of+s.h.i.e.l.d.")]
|
||||
// [TestCase("Marvel's Agents of S.H.I.E.L.D.", "marvels+agents+of+s.h.i.e.l.d.")]
|
||||
//// [TestCase("Marvel'sAgentsOfS.H.I.E.L.D.", "marvels+agents+of+s.h.i.e.l.d.")]
|
||||
// [TestCase("Utopia (US) (2014)", "utopia+us+2014")]
|
||||
// [TestCase("Utopia US 2014", "utopia+us+2014")]
|
||||
//// [TestCase("UtopiaUS2014", "utopia+us+2014")]
|
||||
// [TestCase("@Midnight", "midnight")]
|
||||
//// [TestCase("The4400", "the+4400")]
|
||||
//// [TestCase("StargateSG-1", "stargate+sg-1")]
|
||||
//// [TestCase("Warehouse13", "warehouse+13")]
|
||||
//// [TestCase("Ben10AlienForce", "ben+10+alien+force")]
|
||||
//// [TestCase("FridayThe13thTheSeries","friday+the+13th+the+series")]
|
||||
// [TestCase("W1A", "w1a")]
|
||||
// [TestCase("O2Be", "o2be")]
|
||||
//// [TestCase("TeenMom2", "teen+mom+2")]
|
||||
// [TestCase("123-456-789", "123-456-789")]
|
||||
//// [TestCase("BuckRodgersInThe25thCentury", "buck+rodgers+in+the+25th+century")]
|
||||
//// [TestCase("EPDaily", "ep+daily")]
|
||||
// [TestCase("6ad072c8-d000-4ed5-97d5-324858c45774", "6ad072c8-d000-4ed5-97d5-324858c45774")]
|
||||
// [TestCase("6AD072C8-D000-4ED5-97D5-324858C45774", "6ad072c8-d000-4ed5-97d5-324858c45774")]
|
||||
// [TestCase("MythBusters", "mythbusters")]
|
||||
// public void search_by_query(string title, string expectedPartialQuery)
|
||||
// {
|
||||
// expectedPartialQuery = String.Format("query={0}&", expectedPartialQuery);
|
||||
//
|
||||
// Assert.Throws<TraktException>(() => Subject.SearchForNewSeries(title));
|
||||
//
|
||||
// Mocker.GetMock<IHttpClient>()
|
||||
// .Verify(v => v.Get<List<Show>>(It.Is<HttpRequest>(d => d.Url.ToString().Contains(expectedPartialQuery))), Times.Once());
|
||||
//
|
||||
// ExceptionVerification.ExpectedWarns(1);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -4,7 +4,6 @@ using System.Linq;
|
||||
using System.Net;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.MediaCover;
|
||||
using NzbDrone.Core.MetadataSource;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
@@ -42,17 +41,22 @@ namespace NzbDrone.Core.Test.MetadataSourceTests
|
||||
result.Should().NotBeEmpty();
|
||||
|
||||
result[0].Title.Should().Be(expected);
|
||||
|
||||
ExceptionVerification.IgnoreWarns();
|
||||
}
|
||||
|
||||
[TestCase("tvdbid:")]
|
||||
[TestCase("tvdbid: 99999999999999999999")]
|
||||
[TestCase("tvdbid: 0")]
|
||||
[TestCase("tvdbid: -12")]
|
||||
[TestCase("tvdbid:289578")]
|
||||
[TestCase("adjalkwdjkalwdjklawjdlKAJD;EF")]
|
||||
public void no_search_result(string term)
|
||||
{
|
||||
var result = Subject.SearchForNewSeries(term);
|
||||
result.Should().BeEmpty();
|
||||
|
||||
ExceptionVerification.IgnoreWarns();
|
||||
}
|
||||
|
||||
[TestCase(75978, "Family Guy")]
|
||||
@@ -71,9 +75,9 @@ namespace NzbDrone.Core.Test.MetadataSourceTests
|
||||
[Test]
|
||||
public void getting_details_of_invalid_series()
|
||||
{
|
||||
Assert.Throws<WebException>(() => Subject.GetSeriesInfo(Int32.MaxValue));
|
||||
Assert.Throws<Common.Http.HttpException>(() => Subject.GetSeriesInfo(Int32.MaxValue));
|
||||
|
||||
//ExceptionVerification.ExpectedWarns(1);
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
Reference in New Issue
Block a user