mirror of
https://github.com/lidarr/Lidarr
synced 2024-12-25 17:17:02 +00:00
EpisodeSearch now gets the proper QualityProfile (broken after removing AttachSeries), tests updated.
This commit is contained in:
parent
1f2a1e3206
commit
a56213047f
2 changed files with 59 additions and 9 deletions
|
@ -198,10 +198,6 @@ public void processResults_failed_download_should_not_check_the_rest()
|
||||||
ExceptionVerification.ExcpectedErrors(1);
|
ExceptionVerification.ExcpectedErrors(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void start_should_search_all_providers()
|
public void start_should_search_all_providers()
|
||||||
{
|
{
|
||||||
|
@ -233,6 +229,10 @@ public void start_should_search_all_providers()
|
||||||
.Setup(c => c.GetEnabledIndexers())
|
.Setup(c => c.GetEnabledIndexers())
|
||||||
.Returns(indexers);
|
.Returns(indexers);
|
||||||
|
|
||||||
|
mocker.GetMock<SeriesProvider>()
|
||||||
|
.Setup(c => c.GetSeries(It.IsAny<int>()))
|
||||||
|
.Returns(episode.Series);
|
||||||
|
|
||||||
mocker.GetMock<InventoryProvider>()
|
mocker.GetMock<InventoryProvider>()
|
||||||
.Setup(c => c.IsQualityNeeded(It.IsAny<EpisodeParseResult>())).Returns(false);
|
.Setup(c => c.IsQualityNeeded(It.IsAny<EpisodeParseResult>())).Returns(false);
|
||||||
|
|
||||||
|
@ -273,7 +273,6 @@ public void start_should_use_scene_name_to_search()
|
||||||
indexer1.Setup(c => c.FetchEpisode("The Daily Show", episode.SeasonNumber, episode.EpisodeNumber))
|
indexer1.Setup(c => c.FetchEpisode("The Daily Show", episode.SeasonNumber, episode.EpisodeNumber))
|
||||||
.Returns(parseResults).Verifiable();
|
.Returns(parseResults).Verifiable();
|
||||||
|
|
||||||
|
|
||||||
var indexer2 = new Mock<IndexerBase>();
|
var indexer2 = new Mock<IndexerBase>();
|
||||||
indexer2.Setup(c => c.FetchEpisode("The Daily Show", episode.SeasonNumber, episode.EpisodeNumber))
|
indexer2.Setup(c => c.FetchEpisode("The Daily Show", episode.SeasonNumber, episode.EpisodeNumber))
|
||||||
.Returns(parseResults).Verifiable();
|
.Returns(parseResults).Verifiable();
|
||||||
|
@ -284,6 +283,10 @@ public void start_should_use_scene_name_to_search()
|
||||||
.Setup(c => c.GetEnabledIndexers())
|
.Setup(c => c.GetEnabledIndexers())
|
||||||
.Returns(indexers);
|
.Returns(indexers);
|
||||||
|
|
||||||
|
mocker.GetMock<SeriesProvider>()
|
||||||
|
.Setup(c => c.GetSeries(It.IsAny<int>()))
|
||||||
|
.Returns(episode.Series);
|
||||||
|
|
||||||
mocker.GetMock<InventoryProvider>()
|
mocker.GetMock<InventoryProvider>()
|
||||||
.Setup(c => c.IsQualityNeeded(It.IsAny<EpisodeParseResult>())).Returns(false);
|
.Setup(c => c.IsQualityNeeded(It.IsAny<EpisodeParseResult>())).Returns(false);
|
||||||
|
|
||||||
|
@ -303,7 +306,6 @@ public void start_should_use_scene_name_to_search()
|
||||||
indexer2.VerifyAll();
|
indexer2.VerifyAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void start_failed_indexer_should_not_break_job()
|
public void start_failed_indexer_should_not_break_job()
|
||||||
{
|
{
|
||||||
|
@ -341,6 +343,10 @@ public void start_failed_indexer_should_not_break_job()
|
||||||
.Setup(c => c.GetEnabledIndexers())
|
.Setup(c => c.GetEnabledIndexers())
|
||||||
.Returns(indexers);
|
.Returns(indexers);
|
||||||
|
|
||||||
|
mocker.GetMock<SeriesProvider>()
|
||||||
|
.Setup(c => c.GetSeries(It.IsAny<int>()))
|
||||||
|
.Returns(episode.Series);
|
||||||
|
|
||||||
mocker.GetMock<InventoryProvider>()
|
mocker.GetMock<InventoryProvider>()
|
||||||
.Setup(c => c.IsQualityNeeded(It.IsAny<EpisodeParseResult>())).Returns(false);
|
.Setup(c => c.IsQualityNeeded(It.IsAny<EpisodeParseResult>())).Returns(false);
|
||||||
|
|
||||||
|
@ -363,7 +369,6 @@ public void start_failed_indexer_should_not_break_job()
|
||||||
indexer3.VerifyAll();
|
indexer3.VerifyAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void start_no_episode_found_should_return_with_error_logged()
|
public void start_no_episode_found_should_return_with_error_logged()
|
||||||
{
|
{
|
||||||
|
@ -381,5 +386,51 @@ public void start_no_episode_found_should_return_with_error_logged()
|
||||||
mocker.VerifyAllMocks();
|
mocker.VerifyAllMocks();
|
||||||
ExceptionVerification.ExcpectedErrors(1);
|
ExceptionVerification.ExcpectedErrors(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void episode_search_should_call_get_series()
|
||||||
|
{
|
||||||
|
var parseResults = Builder<EpisodeParseResult>.CreateListOfSize(4)
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
var episode = Builder<Episode>.CreateNew()
|
||||||
|
.With(c => c.Series = Builder<Series>.CreateNew().Build())
|
||||||
|
.With(c => c.SeasonNumber = 12)
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
var mocker = new AutoMoqer(MockBehavior.Strict);
|
||||||
|
|
||||||
|
mocker.GetMock<EpisodeProvider>()
|
||||||
|
.Setup(c => c.GetEpisode(episode.EpisodeId))
|
||||||
|
.Returns(episode);
|
||||||
|
|
||||||
|
var indexer1 = new Mock<IndexerBase>();
|
||||||
|
indexer1.Setup(c => c.FetchEpisode(episode.Series.Title, episode.SeasonNumber, episode.EpisodeNumber))
|
||||||
|
.Returns(parseResults).Verifiable();
|
||||||
|
|
||||||
|
var indexers = new List<IndexerBase> { indexer1.Object };
|
||||||
|
|
||||||
|
mocker.GetMock<IndexerProvider>()
|
||||||
|
.Setup(c => c.GetEnabledIndexers())
|
||||||
|
.Returns(indexers);
|
||||||
|
|
||||||
|
mocker.GetMock<InventoryProvider>()
|
||||||
|
.Setup(c => c.IsQualityNeeded(It.IsAny<EpisodeParseResult>())).Returns(false);
|
||||||
|
|
||||||
|
mocker.GetMock<SceneMappingProvider>()
|
||||||
|
.Setup(s => s.GetSceneName(It.IsAny<int>())).Returns("");
|
||||||
|
|
||||||
|
mocker.GetMock<SeriesProvider>()
|
||||||
|
.Setup(s => s.GetSeries(It.IsAny<int>())).Returns(episode.Series);
|
||||||
|
|
||||||
|
//Act
|
||||||
|
mocker.Resolve<SearchProvider>().EpisodeSearch(new ProgressNotification("Test"), episode.EpisodeId);
|
||||||
|
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
mocker.VerifyAllMocks();
|
||||||
|
ExceptionVerification.ExcpectedWarns(1);
|
||||||
|
indexer1.VerifyAll();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -150,8 +150,7 @@ public virtual bool EpisodeSearch(ProgressNotification notification, int episode
|
||||||
}
|
}
|
||||||
notification.CurrentMessage = "Searching for " + episode;
|
notification.CurrentMessage = "Searching for " + episode;
|
||||||
|
|
||||||
|
var series = _seriesProvider.GetSeries(episode.SeriesId);
|
||||||
var series = episode.Series;
|
|
||||||
|
|
||||||
var indexers = _indexerProvider.GetEnabledIndexers();
|
var indexers = _indexerProvider.GetEnabledIndexers();
|
||||||
var reports = new List<EpisodeParseResult>();
|
var reports = new List<EpisodeParseResult>();
|
||||||
|
|
Loading…
Reference in a new issue