Added RSS support for torrents

This commit is contained in:
Keivan Beigi
2013-09-13 16:17:58 -07:00
parent 89d603d71c
commit 82b06bab7a
59 changed files with 577 additions and 268 deletions
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using FluentAssertions;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.Indexers.Eztv;
using NzbDrone.Core.Indexers.Newznab;
using NzbDrone.Core.Indexers.NzbClub;
using NzbDrone.Core.Indexers.Wombles;
@@ -8,6 +9,7 @@ using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Test.Framework;
using NUnit.Framework;
using NzbDrone.Test.Common.Categories;
using System.Linq;
namespace NzbDrone.Core.Test.IndexerTests.IntegrationTests
{
@@ -43,6 +45,17 @@ namespace NzbDrone.Core.Test.IndexerTests.IntegrationTests
}
[Test]
public void extv_rss()
{
var indexer = new Eztv();
var result = Subject.FetchRss(indexer);
ValidateTorrentResult(result, skipSize: false, skipInfo: true);
}
[Test]
public void nzbsorg_rss()
{
@@ -63,15 +76,17 @@ namespace NzbDrone.Core.Test.IndexerTests.IntegrationTests
private void ValidateResult(IList<ReportInfo> reports, bool skipSize = false, bool skipInfo = false)
private void ValidateResult(IList<ReleaseInfo> reports, bool skipSize = false, bool skipInfo = false)
{
reports.Should().NotBeEmpty();
reports.Should().OnlyContain(c => !string.IsNullOrWhiteSpace(c.Title));
reports.Should().OnlyContain(c => !string.IsNullOrWhiteSpace(c.NzbUrl));
reports.Should().NotContain(c => string.IsNullOrWhiteSpace(c.Title));
reports.Should().NotContain(c => string.IsNullOrWhiteSpace(c.DownloadUrl));
reports.Should().OnlyContain(c => c.PublishDate.Year > 2000);
reports.Should().OnlyContain(c => c.DownloadUrl.StartsWith("http"));
if (!skipInfo)
{
reports.Should().OnlyContain(c => !string.IsNullOrWhiteSpace(c.NzbInfoUrl));
reports.Should().NotContain(c => string.IsNullOrWhiteSpace(c.InfoUrl));
}
if (!skipSize)
@@ -80,5 +95,18 @@ namespace NzbDrone.Core.Test.IndexerTests.IntegrationTests
}
}
private void ValidateTorrentResult(IList<ReleaseInfo> reports, bool skipSize = false, bool skipInfo = false)
{
reports.Should().OnlyContain(c => c.GetType() == typeof(TorrentInfo));
ValidateResult(reports, skipSize, skipInfo);
reports.Should().OnlyContain(c => c.DownloadUrl.EndsWith(".torrent"));
reports.Cast<TorrentInfo>().Should().OnlyContain(c => c.MagnetUrl.StartsWith("magnet:"));
reports.Cast<TorrentInfo>().Should().NotContain(c => string.IsNullOrWhiteSpace(c.InfoHash));
}
}
}
}