Added NzbMatrix Search Url, with tests.

This commit is contained in:
Mark McDowall 2011-06-03 22:32:55 -07:00
parent 7291497ce0
commit 5e02ab972c
2 changed files with 53 additions and 9 deletions

View File

@ -117,7 +117,6 @@ namespace NzbDrone.Core.Test
Assert.AreEqual(quality, result.Quality.QualityType); Assert.AreEqual(quality, result.Quality.QualityType);
} }
[Test] [Test]
[TestCase("Adventure.Inc.DVDRip.XviD-OSiTV")] [TestCase("Adventure.Inc.DVDRip.XviD-OSiTV")]
public void custome_parser_full_parse(string title) public void custome_parser_full_parse(string title)
@ -143,8 +142,6 @@ namespace NzbDrone.Core.Test
ExceptionVerification.ExcpectedWarns(1); ExceptionVerification.ExcpectedWarns(1);
} }
[Test] [Test]
public void downloadFeed() public void downloadFeed()
{ {
@ -161,7 +158,6 @@ namespace NzbDrone.Core.Test
ExceptionVerification.IgnoreWarns(); ExceptionVerification.IgnoreWarns();
} }
[Test] [Test]
public void nzbsorg_search_returns_valid_results() public void nzbsorg_search_returns_valid_results()
{ {
@ -175,7 +171,6 @@ namespace NzbDrone.Core.Test
.SetupGet(c => c.NzbsOrgHash) .SetupGet(c => c.NzbsOrgHash)
.Returns("bc8edb4cc49d4ae440775adec5ac001f"); .Returns("bc8edb4cc49d4ae440775adec5ac001f");
mocker.Resolve<HttpProvider>(); mocker.Resolve<HttpProvider>();
var result = mocker.Resolve<NzbsOrg>().FetchEpisode("Simpsons", 21, 23); var result = mocker.Resolve<NzbsOrg>().FetchEpisode("Simpsons", 21, 23);
@ -186,7 +181,6 @@ namespace NzbDrone.Core.Test
result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(23)); result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(23));
} }
[Test] [Test]
public void newzbin_search_returns_valid_results() public void newzbin_search_returns_valid_results()
{ {
@ -200,7 +194,6 @@ namespace NzbDrone.Core.Test
.SetupGet(c => c.NewzbinPassword) .SetupGet(c => c.NewzbinPassword)
.Returns("smartar39865"); .Returns("smartar39865");
mocker.Resolve<HttpProvider>(); mocker.Resolve<HttpProvider>();
var result = mocker.Resolve<Newzbin>().FetchEpisode("Simpsons", 21, 23); var result = mocker.Resolve<Newzbin>().FetchEpisode("Simpsons", 21, 23);
@ -211,6 +204,28 @@ namespace NzbDrone.Core.Test
result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(23)); result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(23));
} }
[Test]
public void nzbmatrix_search_returns_valid_results()
{
var mocker = new AutoMoqer();
mocker.GetMock<ConfigProvider>()
.SetupGet(c => c.NzbMatrixUsername)
.Returns("");
mocker.GetMock<ConfigProvider>()
.SetupGet(c => c.NzbMatrixApiKey)
.Returns("");
mocker.Resolve<HttpProvider>();
var result = mocker.Resolve<NzbMatrix>().FetchEpisode("Simpsons", 21, 23);
result.Should().NotBeEmpty();
result.Should().OnlyContain(r => r.CleanTitle == "simpsons");
result.Should().OnlyContain(r => r.SeasonNumber == 21);
result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(23));
}
[Test] [Test]
public void nzbsorg_multi_word_search_returns_valid_results() public void nzbsorg_multi_word_search_returns_valid_results()
@ -225,7 +240,6 @@ namespace NzbDrone.Core.Test
.SetupGet(c => c.NzbsOrgHash) .SetupGet(c => c.NzbsOrgHash)
.Returns("bc8edb4cc49d4ae440775adec5ac001f"); .Returns("bc8edb4cc49d4ae440775adec5ac001f");
mocker.Resolve<HttpProvider>(); mocker.Resolve<HttpProvider>();
var result = mocker.Resolve<NzbsOrg>().FetchEpisode("Blue Bloods", 1, 19); var result = mocker.Resolve<NzbsOrg>().FetchEpisode("Blue Bloods", 1, 19);
@ -236,5 +250,28 @@ namespace NzbDrone.Core.Test
result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(19)); result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(19));
} }
[Test]
public void nzbmatrix_multi_word_search_returns_valid_results()
{
var mocker = new AutoMoqer();
mocker.GetMock<ConfigProvider>()
.SetupGet(c => c.NzbMatrixUsername)
.Returns("");
mocker.GetMock<ConfigProvider>()
.SetupGet(c => c.NzbMatrixApiKey)
.Returns("");
mocker.Resolve<HttpProvider>();
var result = mocker.Resolve<NzbMatrix>().FetchEpisode("Blue Bloods", 1, 19);
result.Should().NotBeEmpty();
result.Should().OnlyContain(r => r.CleanTitle == "bluebloods");
result.Should().OnlyContain(r => r.SeasonNumber == 1);
result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(19));
}
} }
} }

View File

@ -42,7 +42,14 @@ namespace NzbDrone.Core.Providers.Indexer
protected override IList<string> GetSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber) protected override IList<string> GetSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
{ {
return new List<string>(); var searchUrls = new List<String>();
foreach (var url in Urls)
{
searchUrls.Add(String.Format("{0}&term={1}+s{2:00}e{3:00}", url, GetQueryTitle(seriesTitle), seasonNumber, episodeNumber));
}
return searchUrls;
} }
} }