2013-06-08 20:29:19 +03:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using FluentAssertions;
|
2013-06-04 06:33:03 +03:00
|
|
|
using NzbDrone.Core.Indexers;
|
|
|
|
using NzbDrone.Core.Indexers.Newznab;
|
|
|
|
using NzbDrone.Core.Indexers.NzbClub;
|
2013-06-08 20:53:26 +03:00
|
|
|
using NzbDrone.Core.Indexers.Wombles;
|
2013-06-08 20:29:19 +03:00
|
|
|
using NzbDrone.Core.Parser.Model;
|
2013-06-04 06:33:03 +03:00
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
using NUnit.Framework;
|
2013-06-08 20:29:19 +03:00
|
|
|
using NzbDrone.Test.Common.Categories;
|
2013-06-04 06:33:03 +03:00
|
|
|
|
|
|
|
namespace NzbDrone.Core.Test.IndexerTests.IntegrationTests
|
|
|
|
{
|
2013-06-08 20:29:19 +03:00
|
|
|
[IntegrationTest]
|
2013-06-04 06:33:03 +03:00
|
|
|
public class IndexerIntegrationTests : CoreTest<FetchFeedService>
|
|
|
|
{
|
2013-06-08 20:29:19 +03:00
|
|
|
[SetUp]
|
|
|
|
public void SetUp()
|
2013-06-04 06:33:03 +03:00
|
|
|
{
|
|
|
|
UseRealHttp();
|
2013-06-08 20:53:26 +03:00
|
|
|
|
2013-06-08 20:29:19 +03:00
|
|
|
}
|
2013-06-04 06:33:03 +03:00
|
|
|
|
2013-06-08 20:29:19 +03:00
|
|
|
[Test]
|
2013-06-28 04:14:01 +03:00
|
|
|
[Explicit]
|
2013-06-08 20:29:19 +03:00
|
|
|
public void nzbclub_rss()
|
|
|
|
{
|
2013-06-04 06:33:03 +03:00
|
|
|
var indexer = new NzbClub();
|
|
|
|
|
|
|
|
var result = Subject.FetchRss(indexer);
|
|
|
|
|
2013-06-08 20:29:19 +03:00
|
|
|
ValidateResult(result);
|
|
|
|
}
|
2013-06-04 06:33:03 +03:00
|
|
|
|
2013-06-08 20:53:26 +03:00
|
|
|
[Test]
|
|
|
|
public void wombles_rss()
|
|
|
|
{
|
|
|
|
var indexer = new Wombles();
|
|
|
|
|
|
|
|
var result = Subject.FetchRss(indexer);
|
|
|
|
|
|
|
|
ValidateResult(result, skipSize: true, skipInfo: true);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-06-04 06:33:03 +03:00
|
|
|
[Test]
|
|
|
|
[Explicit("needs newznab api key")]
|
|
|
|
public void nzbsorg_rss()
|
|
|
|
{
|
|
|
|
var indexer = new Newznab();
|
|
|
|
indexer.Settings = new NewznabSettings
|
|
|
|
{
|
|
|
|
ApiKey = "",
|
|
|
|
Url = "http://nzbs.org"
|
|
|
|
};
|
|
|
|
|
|
|
|
indexer.InstanceDefinition = new IndexerDefinition();
|
|
|
|
|
|
|
|
var result = Subject.FetchRss(indexer);
|
|
|
|
|
2013-06-08 20:53:26 +03:00
|
|
|
ValidateResult(result);
|
2013-06-04 06:33:03 +03:00
|
|
|
}
|
|
|
|
|
2013-06-08 20:29:19 +03:00
|
|
|
|
|
|
|
|
2013-06-08 20:53:26 +03:00
|
|
|
private void ValidateResult(IList<ReportInfo> reports, bool skipSize = false, bool skipInfo = false)
|
2013-06-08 20:29:19 +03:00
|
|
|
{
|
|
|
|
reports.Should().NotBeEmpty();
|
|
|
|
reports.Should().OnlyContain(c => !string.IsNullOrWhiteSpace(c.Title));
|
|
|
|
reports.Should().OnlyContain(c => !string.IsNullOrWhiteSpace(c.NzbUrl));
|
2013-06-08 20:53:26 +03:00
|
|
|
|
|
|
|
if (!skipInfo)
|
|
|
|
{
|
|
|
|
reports.Should().OnlyContain(c => !string.IsNullOrWhiteSpace(c.NzbInfoUrl));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!skipSize)
|
|
|
|
{
|
|
|
|
reports.Should().OnlyContain(c => c.Size > 0);
|
|
|
|
}
|
2013-06-08 20:29:19 +03:00
|
|
|
}
|
|
|
|
|
2013-06-04 06:33:03 +03:00
|
|
|
}
|
|
|
|
}
|