mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-19 21:46:50 -04:00
Fixed all tests and even added some new ones :) (#835)
* First fixing of tests. * Updated more tests. * Fix some tests * Fix all prioritization tests. And add new for preferred words. * Updated CompletedDownloadservice tests * Fixed a lot of tests * Fixed all indexer requests. We should add more for the indexers we added. To lazy for that though ¯\_(ツ)_/¯ * Fixed organizer tests. Should probably be also updated to incorporate our newly added tags. * Fix notification tests. * Fixed update test for osx * Fixed a few more tests. * Fixed some more tests. * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update appveyor.yml * Update activity.less * Update appveyor.yml * Update appveyor.yml * Update CommonVersionInfo.cs * Update build-appveyor.cake Let's hope this works. * Update CommonVersionInfo.cs Just to kickstart appveyor * Fixed a few tests * Just ignore those tests. * Fixed more tests. * First steps in fixing Core.Test.Download.DownloadApprovedFixture * Fix most DownloadApprovedFixture tests * Fixed something. * Fixed a few more tests. * Fixed pending release tests. * All Core tests are now fixed. * Fixed the last tests :) * Fixed Download Station Tests. * Fixed Vuze and Transmission default settings which caused the tests to fail. * Fix most tests. * Fix RootFolder tests. * Fixed last tests
This commit is contained in:
+15
-161
@@ -11,8 +11,7 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
|
||||
{
|
||||
public class NewznabRequestGeneratorFixture : CoreTest<NewznabRequestGenerator>
|
||||
{
|
||||
private SingleEpisodeSearchCriteria _singleEpisodeSearchCriteria;
|
||||
private AnimeEpisodeSearchCriteria _animeSearchCriteria;
|
||||
private MovieSearchCriteria _movieSearchCriteria;
|
||||
private NewznabCapabilities _capabilities;
|
||||
|
||||
[SetUp]
|
||||
@@ -26,18 +25,9 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
|
||||
ApiKey = "abcd",
|
||||
};
|
||||
|
||||
_singleEpisodeSearchCriteria = new SingleEpisodeSearchCriteria
|
||||
_movieSearchCriteria = new MovieSearchCriteria
|
||||
{
|
||||
Series = new Tv.Series { TvRageId = 10, TvdbId = 20, TvMazeId = 30 },
|
||||
SceneTitles = new List<string> { "Monkey Island" },
|
||||
SeasonNumber = 1,
|
||||
EpisodeNumber = 2
|
||||
};
|
||||
|
||||
_animeSearchCriteria = new AnimeEpisodeSearchCriteria()
|
||||
{
|
||||
SceneTitles = new List<string>() { "Monkey+Island" },
|
||||
AbsoluteEpisodeNumber = 100
|
||||
Movie = new Tv.Movie { ImdbId = "tt0076759", Title = "Star Wars", Year = 1977 }
|
||||
};
|
||||
|
||||
_capabilities = new NewznabCapabilities();
|
||||
@@ -73,34 +63,10 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
|
||||
page.Url.FullUri.Should().Contain("&cat=1,2,3,4&");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_use_only_anime_categories_for_anime_search()
|
||||
{
|
||||
var results = Subject.GetSearchRequests(_animeSearchCriteria);
|
||||
|
||||
results.GetAllTiers().Should().HaveCount(1);
|
||||
|
||||
var page = results.GetAllTiers().First().First();
|
||||
|
||||
page.Url.FullUri.Should().Contain("&cat=3,4&");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_use_mode_search_for_anime()
|
||||
{
|
||||
var results = Subject.GetSearchRequests(_animeSearchCriteria);
|
||||
|
||||
results.GetAllTiers().Should().HaveCount(1);
|
||||
|
||||
var page = results.GetAllTiers().First().First();
|
||||
|
||||
page.Url.FullUri.Should().Contain("?t=search&");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_subsequent_pages()
|
||||
{
|
||||
var results = Subject.GetSearchRequests(_animeSearchCriteria);
|
||||
var results = Subject.GetSearchRequests(_movieSearchCriteria);
|
||||
|
||||
results.GetAllTiers().Should().HaveCount(1);
|
||||
|
||||
@@ -114,7 +80,7 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
|
||||
[Test]
|
||||
public void should_not_get_unlimited_pages()
|
||||
{
|
||||
var results = Subject.GetSearchRequests(_animeSearchCriteria);
|
||||
var results = Subject.GetSearchRequests(_movieSearchCriteria);
|
||||
|
||||
results.GetAllTiers().Should().HaveCount(1);
|
||||
|
||||
@@ -124,144 +90,32 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_search_by_rid_if_not_supported()
|
||||
public void should_not_search_by_imdbid_if_not_supported()
|
||||
{
|
||||
_capabilities.SupportedTvSearchParameters = new[] { "q", "season", "ep" };
|
||||
_capabilities.SupportedMovieSearchParameters = new[] { "q" };
|
||||
|
||||
var results = Subject.GetSearchRequests(_singleEpisodeSearchCriteria);
|
||||
var results = Subject.GetSearchRequests(_movieSearchCriteria);
|
||||
|
||||
results.GetAllTiers().Should().HaveCount(1);
|
||||
|
||||
var page = results.GetAllTiers().First().First();
|
||||
|
||||
page.Url.Query.Should().NotContain("rid=10");
|
||||
page.Url.Query.Should().Contain("q=Monkey");
|
||||
page.Url.Query.Should().NotContain("imdbid=0076759");
|
||||
page.Url.Query.Should().Contain("q=star");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_search_by_rid_if_supported()
|
||||
public void should_search_by_imdbid_if_supported()
|
||||
{
|
||||
var results = Subject.GetSearchRequests(_singleEpisodeSearchCriteria);
|
||||
_capabilities.SupportedMovieSearchParameters = new[] { "q", "imdbid" };
|
||||
|
||||
var results = Subject.GetSearchRequests(_movieSearchCriteria);
|
||||
results.GetTier(0).Should().HaveCount(1);
|
||||
|
||||
var page = results.GetAllTiers().First().First();
|
||||
|
||||
page.Url.Query.Should().Contain("rid=10");
|
||||
page.Url.Query.Should().Contain("imdbid=0076759");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_search_by_tvdbid_if_not_supported()
|
||||
{
|
||||
_capabilities.SupportedTvSearchParameters = new[] { "q", "season", "ep" };
|
||||
|
||||
var results = Subject.GetSearchRequests(_singleEpisodeSearchCriteria);
|
||||
results.GetTier(0).Should().HaveCount(1);
|
||||
|
||||
var page = results.GetAllTiers().First().First();
|
||||
|
||||
page.Url.Query.Should().NotContain("rid=10");
|
||||
page.Url.Query.Should().Contain("q=Monkey");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_search_by_tvdbid_if_supported()
|
||||
{
|
||||
_capabilities.SupportedTvSearchParameters = new[] { "q", "tvdbid", "season", "ep" };
|
||||
|
||||
var results = Subject.GetSearchRequests(_singleEpisodeSearchCriteria);
|
||||
results.GetTier(0).Should().HaveCount(1);
|
||||
|
||||
var page = results.GetAllTiers().First().First();
|
||||
|
||||
page.Url.Query.Should().Contain("tvdbid=20");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_search_by_tvmaze_if_supported()
|
||||
{
|
||||
_capabilities.SupportedTvSearchParameters = new[] { "q", "tvmazeid", "season", "ep" };
|
||||
|
||||
var results = Subject.GetSearchRequests(_singleEpisodeSearchCriteria);
|
||||
results.GetTier(0).Should().HaveCount(1);
|
||||
|
||||
var page = results.GetAllTiers().First().First();
|
||||
|
||||
page.Url.Query.Should().Contain("tvmazeid=30");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_prefer_search_by_tvdbid_if_rid_supported()
|
||||
{
|
||||
_capabilities.SupportedTvSearchParameters = new[] { "q", "tvdbid", "rid", "season", "ep" };
|
||||
|
||||
var results = Subject.GetSearchRequests(_singleEpisodeSearchCriteria);
|
||||
results.GetTier(0).Should().HaveCount(1);
|
||||
|
||||
var page = results.GetAllTiers().First().First();
|
||||
|
||||
page.Url.Query.Should().Contain("tvdbid=20");
|
||||
page.Url.Query.Should().NotContain("rid=10");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_use_aggregrated_id_search_if_supported()
|
||||
{
|
||||
_capabilities.SupportedTvSearchParameters = new[] { "q", "tvdbid", "rid", "season", "ep" };
|
||||
_capabilities.SupportsAggregateIdSearch = true;
|
||||
|
||||
var results = Subject.GetSearchRequests(_singleEpisodeSearchCriteria);
|
||||
results.GetTier(0).Should().HaveCount(1);
|
||||
|
||||
var page = results.GetTier(0).First().First();
|
||||
|
||||
page.Url.Query.Should().Contain("tvdbid=20");
|
||||
page.Url.Query.Should().Contain("rid=10");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_use_aggregrated_id_search_if_no_ids_supported()
|
||||
{
|
||||
_capabilities.SupportedTvSearchParameters = new[] { "q", "season", "ep" };
|
||||
_capabilities.SupportsAggregateIdSearch = true; // Turns true if indexer supplies supportedParams.
|
||||
|
||||
var results = Subject.GetSearchRequests(_singleEpisodeSearchCriteria);
|
||||
results.Tiers.Should().Be(1);
|
||||
results.GetTier(0).Should().HaveCount(1);
|
||||
|
||||
var page = results.GetTier(0).First().First();
|
||||
|
||||
page.Url.Query.Should().Contain("q=");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_use_aggregrated_id_search_if_no_ids_are_known()
|
||||
{
|
||||
_capabilities.SupportedTvSearchParameters = new[] { "q", "rid", "season", "ep" };
|
||||
_capabilities.SupportsAggregateIdSearch = true; // Turns true if indexer supplies supportedParams.
|
||||
|
||||
_singleEpisodeSearchCriteria.Series.TvRageId = 0;
|
||||
|
||||
var results = Subject.GetSearchRequests(_singleEpisodeSearchCriteria);
|
||||
|
||||
var page = results.GetTier(0).First().First();
|
||||
|
||||
page.Url.Query.Should().Contain("q=");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_fallback_to_q()
|
||||
{
|
||||
_capabilities.SupportedTvSearchParameters = new[] { "q", "tvdbid", "rid", "season", "ep" };
|
||||
_capabilities.SupportsAggregateIdSearch = true;
|
||||
|
||||
var results = Subject.GetSearchRequests(_singleEpisodeSearchCriteria);
|
||||
results.Tiers.Should().Be(2);
|
||||
|
||||
var pageTier2 = results.GetTier(1).First().First();
|
||||
|
||||
pageTier2.Url.Query.Should().NotContain("tvdbid=20");
|
||||
pageTier2.Url.Query.Should().NotContain("rid=10");
|
||||
pageTier2.Url.Query.Should().Contain("q=");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user