From 2855090005e64b1b8d8dd95ea2f231bad2f7d2c9 Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Tue, 21 Feb 2017 17:03:10 +0100 Subject: [PATCH] Fixed: Removed Womble indexer. --- .../Files/Indexers/Wombles/wombles.xml | 78 ------------------- .../IndexerTests/IndexerServiceFixture.cs | 4 +- .../IndexerIntegrationTests.cs | 17 ---- .../WomblesTests/WomblesFixture.cs | 59 -------------- .../NzbDrone.Core.Test.csproj | 5 -- .../Datastore/Migration/107_remove_wombles.cs | 14 ++++ src/NzbDrone.Core/Indexers/Wombles/Wombles.cs | 32 -------- .../Indexers/Wombles/WomblesRssParser.cs | 20 ----- src/NzbDrone.Core/NzbDrone.Core.csproj | 3 +- .../ApiTests/IndexerFixture.cs | 3 +- .../ApiTests/ReleaseFixture.cs | 7 +- .../IntegrationTest.cs | 13 ++-- 12 files changed, 29 insertions(+), 226 deletions(-) delete mode 100644 src/NzbDrone.Core.Test/Files/Indexers/Wombles/wombles.xml delete mode 100644 src/NzbDrone.Core.Test/IndexerTests/WomblesTests/WomblesFixture.cs create mode 100644 src/NzbDrone.Core/Datastore/Migration/107_remove_wombles.cs delete mode 100644 src/NzbDrone.Core/Indexers/Wombles/Wombles.cs delete mode 100644 src/NzbDrone.Core/Indexers/Wombles/WomblesRssParser.cs diff --git a/src/NzbDrone.Core.Test/Files/Indexers/Wombles/wombles.xml b/src/NzbDrone.Core.Test/Files/Indexers/Wombles/wombles.xml deleted file mode 100644 index ee0f7e362..000000000 --- a/src/NzbDrone.Core.Test/Files/Indexers/Wombles/wombles.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - - Womble's NZB Index - http://indexer.local/ - NZB Index - my.email@internet.me - 15 - - - - One.Child.S01E01.720p.HDTV.x264-TLA - http://indexer.local/nzb/bb4/One.Child.S01E01.720p.HDTV.x264-TLA.nzb - - One.Child.S01E01.720p.HDTV.x264-TLA - (Size:956 Mb) - - tv-hd - 2/17/2016 11:03:52 PM - http://indexer.local/nzb/bb4/One.Child.S01E01.720p.HDTV.x264-TLA.nzb - - - - - Midsomer.Murders.S18E06.Harvest.Of.Souls.HDTV.x264-ORGANiC - http://indexer.local/nzb/17c/Midsomer.Murders.S18E06.Harvest.Of.Souls.HDTV.x264-ORGANiC.nzb - - Midsomer.Murders.S18E06.Harvest.Of.Souls.HDTV.x264-ORGANiC - (Size:730 Mb) - - tv-sd - 2/17/2016 10:55:33 PM - http://indexer.local/nzb/17c/Midsomer.Murders.S18E06.Harvest.Of.Souls.HDTV.x264-ORGANiC.nzb - - - - - Forget.and.Forgive.2014.HDTV.x264-SQUEAK - http://indexer.local/nzb/f3f/Forget.and.Forgive.2014.HDTV.x264-SQUEAK.nzb - - Forget.and.Forgive.2014.HDTV.x264-SQUEAK - (Size:719 Mb) - - tv-sd - 2/17/2016 10:25:28 PM - http://indexer.local/nzb/f3f/Forget.and.Forgive.2014.HDTV.x264-SQUEAK.nzb - - - - - National.Geographic.The.Lakeshore.Killers.HDTV.x264-SQUEAK - http://indexer.local/nzb/828/National.Geographic.The.Lakeshore.Killers.HDTV.x264-SQUEAK.nzb - - National.Geographic.The.Lakeshore.Killers.HDTV.x264-SQUEAK - (Size:436 Mb) - - tv-sd - 2/17/2016 10:20:36 PM - http://indexer.local/nzb/828/National.Geographic.The.Lakeshore.Killers.HDTV.x264-SQUEAK.nzb - - - - - Desert.Lands.of.The.Middle.East.E01.Turkeys.Harsh.Paradise.HDTV.x264-SQUEAK - http://indexer.local/nzb/210/Desert.Lands.of.The.Middle.East.E01.Turkeys.Harsh.Paradise.HDTV.x264-SQUEAK.nzb - - Desert.Lands.of.The.Middle.East.E01.Turkeys.Harsh.Paradise.HDTV.x264-SQUEAK - (Size:460 Mb) - - tv-sd - 2/17/2016 10:18:29 PM - http://indexer.local/nzb/210/Desert.Lands.of.The.Middle.East.E01.Turkeys.Harsh.Paradise.HDTV.x264-SQUEAK.nzb - - - - - \ No newline at end of file diff --git a/src/NzbDrone.Core.Test/IndexerTests/IndexerServiceFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/IndexerServiceFixture.cs index eceb25b11..7d4509d8f 100644 --- a/src/NzbDrone.Core.Test/IndexerTests/IndexerServiceFixture.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/IndexerServiceFixture.cs @@ -5,7 +5,6 @@ using NUnit.Framework; using NzbDrone.Core.Indexers; using NzbDrone.Core.Indexers.Newznab; using NzbDrone.Core.Indexers.Omgwtfnzbs; -using NzbDrone.Core.Indexers.Wombles; using NzbDrone.Core.Lifecycle; using NzbDrone.Core.Test.Framework; @@ -22,7 +21,6 @@ namespace NzbDrone.Core.Test.IndexerTests _indexers.Add(Mocker.Resolve()); _indexers.Add(Mocker.Resolve()); - _indexers.Add(Mocker.Resolve()); Mocker.SetConstant>(_indexers); } @@ -44,4 +42,4 @@ namespace NzbDrone.Core.Test.IndexerTests AllStoredModels.Should().NotContain(c => c.Id == existingIndexers.Id); } } -} \ No newline at end of file +} diff --git a/src/NzbDrone.Core.Test/IndexerTests/IntegrationTests/IndexerIntegrationTests.cs b/src/NzbDrone.Core.Test/IndexerTests/IntegrationTests/IndexerIntegrationTests.cs index 0e2ac0894..a72bb8f57 100644 --- a/src/NzbDrone.Core.Test/IndexerTests/IntegrationTests/IndexerIntegrationTests.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/IntegrationTests/IndexerIntegrationTests.cs @@ -5,7 +5,6 @@ using NUnit.Framework; using NzbDrone.Common.Extensions; using NzbDrone.Core.Indexers; using NzbDrone.Core.Indexers.Nyaa; -using NzbDrone.Core.Indexers.Wombles; using NzbDrone.Core.IndexerSearch.Definitions; using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Test.Framework; @@ -39,22 +38,6 @@ namespace NzbDrone.Core.Test.IndexerTests.IntegrationTests }; } - [Test] - public void wombles_fetch_recent() - { - var indexer = Mocker.Resolve(); - - indexer.Definition = new IndexerDefinition - { - Name = "MyIndexer", - Settings = NullConfig.Instance - }; - - var result = indexer.FetchRecent(); - - ValidateResult(result); - } - [Test] public void nyaa_fetch_recent() { diff --git a/src/NzbDrone.Core.Test/IndexerTests/WomblesTests/WomblesFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/WomblesTests/WomblesFixture.cs deleted file mode 100644 index 0c48c1529..000000000 --- a/src/NzbDrone.Core.Test/IndexerTests/WomblesTests/WomblesFixture.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.Linq; -using FluentAssertions; -using Moq; -using NUnit.Framework; -using NzbDrone.Common.Http; -using NzbDrone.Core.Indexers; -using NzbDrone.Core.Indexers.Wombles; -using NzbDrone.Core.Test.Framework; -using NzbDrone.Core.ThingiProvider; - -namespace NzbDrone.Core.Test.IndexerTests.WomblesTests -{ - - [TestFixture] - public class TorrentRssIndexerFixture : CoreTest - { - [SetUp] - public void Setup() - { - - Subject.Definition = new IndexerDefinition() - { - Name = "Wombles", - Settings = new NullConfig(), - }; - } - - private void GivenRecentFeedResponse(string rssXmlFile) - { - var recentFeed = ReadAllText(@"Files/Indexers/" + rssXmlFile); - - Mocker.GetMock() - .Setup(o => o.Execute(It.IsAny())) - .Returns(r => new HttpResponse(r, new HttpHeader(), recentFeed)); - } - - [Test] - public void should_parse_recent_feed_from_wombles() - { - GivenRecentFeedResponse("Wombles/wombles.xml"); - - var releases = Subject.FetchRecent(); - - releases.Should().HaveCount(5); - - var releaseInfo = releases.First(); - - releaseInfo.Title.Should().Be("One.Child.S01E01.720p.HDTV.x264-TLA"); - releaseInfo.DownloadProtocol.Should().Be(DownloadProtocol.Usenet); - releaseInfo.DownloadUrl.Should().Be("http://indexer.local/nzb/bb4/One.Child.S01E01.720p.HDTV.x264-TLA.nzb"); - releaseInfo.InfoUrl.Should().BeNullOrEmpty(); - releaseInfo.CommentUrl.Should().BeNullOrEmpty(); - releaseInfo.Indexer.Should().Be(Subject.Definition.Name); - releaseInfo.PublishDate.Should().Be(DateTime.Parse("2016-02-17 23:03:52 +0000").ToUniversalTime()); - releaseInfo.Size.Should().Be(956*1024*1024); - } - } -} diff --git a/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj b/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj index 12a21d6b3..fa795dd2c 100644 --- a/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj +++ b/src/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj @@ -268,7 +268,6 @@ - @@ -536,10 +535,6 @@ Always - - Always - Designer - Always diff --git a/src/NzbDrone.Core/Datastore/Migration/107_remove_wombles.cs b/src/NzbDrone.Core/Datastore/Migration/107_remove_wombles.cs new file mode 100644 index 000000000..7bbb5ceb7 --- /dev/null +++ b/src/NzbDrone.Core/Datastore/Migration/107_remove_wombles.cs @@ -0,0 +1,14 @@ +using FluentMigrator; +using NzbDrone.Core.Datastore.Migration.Framework; + +namespace NzbDrone.Core.Datastore.Migration +{ + [Migration(107)] + public class remove_wombles : NzbDroneMigrationBase + { + protected override void MainDbUpgrade() + { + Execute.Sql("DELETE FROM Indexers WHERE Implementation = 'Wombles';"); + } + } +} diff --git a/src/NzbDrone.Core/Indexers/Wombles/Wombles.cs b/src/NzbDrone.Core/Indexers/Wombles/Wombles.cs deleted file mode 100644 index 571a85288..000000000 --- a/src/NzbDrone.Core/Indexers/Wombles/Wombles.cs +++ /dev/null @@ -1,32 +0,0 @@ -using NLog; -using NzbDrone.Common.Http; -using NzbDrone.Core.Configuration; -using NzbDrone.Core.Parser; -using NzbDrone.Core.ThingiProvider; - -namespace NzbDrone.Core.Indexers.Wombles -{ - public class Wombles : HttpIndexerBase - { - public override string Name => "Womble's"; - - public override DownloadProtocol Protocol => DownloadProtocol.Usenet; - public override bool SupportsSearch => false; - - public override IParseIndexerResponse GetParser() - { - return new WomblesRssParser(); - } - - public override IIndexerRequestGenerator GetRequestGenerator() - { - return new RssIndexerRequestGenerator("http://newshost.co.za/rss/?sec=TV&fr=false"); - } - - public Wombles(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, IParsingService parsingService, Logger logger) - : base(httpClient, indexerStatusService, configService, parsingService, logger) - { - - } - } -} \ No newline at end of file diff --git a/src/NzbDrone.Core/Indexers/Wombles/WomblesRssParser.cs b/src/NzbDrone.Core/Indexers/Wombles/WomblesRssParser.cs deleted file mode 100644 index 3c357aaf5..000000000 --- a/src/NzbDrone.Core/Indexers/Wombles/WomblesRssParser.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Xml.Linq; - -namespace NzbDrone.Core.Indexers.Wombles -{ - public class WomblesRssParser : RssParser - { - public WomblesRssParser() - { - ParseSizeInDescription = true; - } - - protected override DateTime GetPublishDate(XElement item) - { - var dateString = item.TryGetValue("pubDate") + " +0000"; - - return XElementExtensions.ParseDate(dateString); - } - } -} \ No newline at end of file diff --git a/src/NzbDrone.Core/NzbDrone.Core.csproj b/src/NzbDrone.Core/NzbDrone.Core.csproj index 489e4d528..66423add1 100644 --- a/src/NzbDrone.Core/NzbDrone.Core.csproj +++ b/src/NzbDrone.Core/NzbDrone.Core.csproj @@ -249,6 +249,7 @@ + @@ -671,8 +672,6 @@ - - diff --git a/src/NzbDrone.Integration.Test/ApiTests/IndexerFixture.cs b/src/NzbDrone.Integration.Test/ApiTests/IndexerFixture.cs index 2e38af936..4acf089a4 100644 --- a/src/NzbDrone.Integration.Test/ApiTests/IndexerFixture.cs +++ b/src/NzbDrone.Integration.Test/ApiTests/IndexerFixture.cs @@ -9,6 +9,7 @@ namespace NzbDrone.Integration.Test.ApiTests public class IndexerFixture : IntegrationTest { [Test] + [Ignore("Need mock Newznab to test")] public void should_have_built_in_indexer() { var indexers = Indexers.All(); @@ -18,4 +19,4 @@ namespace NzbDrone.Integration.Test.ApiTests indexers.Where(c => c.ConfigContract == typeof(NullConfig).Name).Should().OnlyContain(c => c.EnableRss); } } -} \ No newline at end of file +} diff --git a/src/NzbDrone.Integration.Test/ApiTests/ReleaseFixture.cs b/src/NzbDrone.Integration.Test/ApiTests/ReleaseFixture.cs index 924a61a2a..d915b6ca3 100644 --- a/src/NzbDrone.Integration.Test/ApiTests/ReleaseFixture.cs +++ b/src/NzbDrone.Integration.Test/ApiTests/ReleaseFixture.cs @@ -7,6 +7,7 @@ using System.Net; namespace NzbDrone.Integration.Test.ApiTests { [TestFixture] + [Ignore("Need mock Newznab to test")] public class ReleaseFixture : IntegrationTest { [Test] @@ -36,8 +37,8 @@ namespace NzbDrone.Integration.Test.ApiTests // But if it didn't accept it, it would return NotFound. // TODO: Maybe we should create a full mock Newznab server endpoint. //var result = Releases.Post(new ReleaseResource { Guid = releases.First().Guid }); - //result.Guid.Should().Be(releases.First().Guid); - + //result.Guid.Should().Be(releases.First().Guid); + var result = Releases.Post(new ReleaseResource { Guid = releases.First().Guid }, HttpStatusCode.InternalServerError); } @@ -55,4 +56,4 @@ namespace NzbDrone.Integration.Test.ApiTests return true; } } -} \ No newline at end of file +} diff --git a/src/NzbDrone.Integration.Test/IntegrationTest.cs b/src/NzbDrone.Integration.Test/IntegrationTest.cs index e97287afd..87a71ec7a 100644 --- a/src/NzbDrone.Integration.Test/IntegrationTest.cs +++ b/src/NzbDrone.Integration.Test/IntegrationTest.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using NLog; +using NzbDrone.Core.Indexers.Newznab; using NzbDrone.Test.Common; namespace NzbDrone.Integration.Test @@ -24,15 +25,15 @@ namespace NzbDrone.Integration.Test protected override void InitializeTestTarget() { - // Add Wombles Indexers.Post(new Api.Indexers.IndexerResource { - EnableRss = true, - ConfigContract = "NullConfig", - Implementation = "Wombles", - Name = "Wombles", + EnableRss = false, + EnableSearch = false, + ConfigContract = nameof(NewznabSettings), + Implementation = nameof(Newznab), + Name = "NewznabTest", Protocol = Core.Indexers.DownloadProtocol.Usenet, - Fields = new List() + Fields = Api.ClientSchema.SchemaBuilder.ToSchema(new NewznabSettings()) }); }