Merge pull request #174 from Sonarr/disable-eztv

Disable EZTV
pull/4/head
Mark McDowall 10 years ago
commit 96ef934aae

@ -0,0 +1,66 @@
using System;
using System.Linq;
using FluentAssertions;
using FluentMigrator;
using NUnit.Framework;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.Datastore.Migration
{
[TestFixture]
public class disable_eztv : MigrationTest<Core.Datastore.Migration.disable_eztv>
{
[Test]
public void should_disable_rss_for_eztv()
{
WithTestDb(c =>
{
InsertIndexer(c, "https://www.ezrss.it/");
});
var indexers = Mocker.Resolve<IndexerRepository>().All().ToList();
indexers.First().EnableRss.Should().BeFalse();
}
[Test]
public void should_disable_search_for_eztv()
{
WithTestDb(c =>
{
InsertIndexer(c, "https://www.ezrss.it/");
});
var indexers = Mocker.Resolve<IndexerRepository>().All().ToList();
indexers.First().EnableSearch.Should().BeFalse();
}
[Test]
public void should_not_disable_if_using_custom_url()
{
WithTestDb(c =>
{
InsertIndexer(c, "https://ezrss.sonarr.tv/");
});
var indexers = Mocker.Resolve<IndexerRepository>().All().ToList();
indexers.First().EnableRss.Should().BeTrue();
indexers.First().EnableSearch.Should().BeTrue();
}
private void InsertIndexer(MigrationBase migrationBase, string url)
{
migrationBase.Insert.IntoTable("Indexers").Row(new
{
Name = "eztv",
Implementation = "Eztv",
Settings = String.Format(@"{{
""baseUrl"": ""{0}""
}}", url),
ConfigContract = "EztvSettings",
EnableRss = 1,
EnableSearch = 1
});
}
}
}

@ -20,7 +20,7 @@ namespace NzbDrone.Core.Test.IndexerTests.EztvTests
Subject.Definition = new IndexerDefinition() Subject.Definition = new IndexerDefinition()
{ {
Name = "Eztv", Name = "Eztv",
Settings = new EztvSettings() Settings = new EztvSettings { BaseUrl = "https://www.ezrss.it/" }
}; };
} }

@ -117,6 +117,7 @@
<Compile Include="Datastore\MappingExtentionFixture.cs" /> <Compile Include="Datastore\MappingExtentionFixture.cs" />
<Compile Include="Datastore\MarrDataLazyLoadingFixture.cs" /> <Compile Include="Datastore\MarrDataLazyLoadingFixture.cs" />
<Compile Include="Datastore\Migration\071_unknown_quality_in_profileFixture.cs" /> <Compile Include="Datastore\Migration\071_unknown_quality_in_profileFixture.cs" />
<Compile Include="Datastore\Migration\074_disable_eztv.cs" />
<Compile Include="Datastore\Migration\072_history_grabIdFixture.cs" /> <Compile Include="Datastore\Migration\072_history_grabIdFixture.cs" />
<Compile Include="Datastore\Migration\070_delay_profileFixture.cs" /> <Compile Include="Datastore\Migration\070_delay_profileFixture.cs" />
<Compile Include="Datastore\ObjectDatabaseFixture.cs" /> <Compile Include="Datastore\ObjectDatabaseFixture.cs" />

@ -0,0 +1,14 @@
using FluentMigrator;
using NzbDrone.Core.Datastore.Migration.Framework;
namespace NzbDrone.Core.Datastore.Migration
{
[Migration(74)]
public class disable_eztv : NzbDroneMigrationBase
{
protected override void MainDbUpgrade()
{
Execute.Sql("UPDATE Indexers SET EnableRss = 0, EnableSearch = 0 WHERE Implementation = 'Eztv' AND Settings LIKE '%ezrss.it%'");
}
}
}

@ -21,10 +21,10 @@ namespace NzbDrone.Core.Indexers.Eztv
public EztvSettings() public EztvSettings()
{ {
BaseUrl = "https://www.ezrss.it/"; BaseUrl = "";
} }
[FieldDefinition(0, Label = "Website URL")] [FieldDefinition(0, Label = "Website URL", HelpText = "Enter to URL to an EZTV compatible RSS feed")]
public String BaseUrl { get; set; } public String BaseUrl { get; set; }
public ValidationResult Validate() public ValidationResult Validate()

@ -232,6 +232,7 @@
<Compile Include="Datastore\Migration\069_quality_proper.cs" /> <Compile Include="Datastore\Migration\069_quality_proper.cs" />
<Compile Include="Datastore\Migration\071_unknown_quality_in_profile.cs" /> <Compile Include="Datastore\Migration\071_unknown_quality_in_profile.cs" />
<Compile Include="Datastore\Migration\072_history_grabid.cs" /> <Compile Include="Datastore\Migration\072_history_grabid.cs" />
<Compile Include="Datastore\Migration\074_disable_eztv.cs" />
<Compile Include="Datastore\Migration\073_clear_ratings.cs" /> <Compile Include="Datastore\Migration\073_clear_ratings.cs" />
<Compile Include="Datastore\Migration\070_delay_profile.cs" /> <Compile Include="Datastore\Migration\070_delay_profile.cs" />
<Compile Include="Datastore\Migration\Framework\MigrationContext.cs" /> <Compile Include="Datastore\Migration\Framework\MigrationContext.cs" />

Loading…
Cancel
Save