1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-27 18:30:45 +00:00

Merge pull request #174 from Sonarr/disable-eztv

Disable EZTV
This commit is contained in:
Mark McDowall 2015-01-17 21:46:21 -08:00
commit 96ef934aae
6 changed files with 85 additions and 3 deletions

View file

@ -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
});
}
}
}

View file

@ -20,7 +20,7 @@ public void Setup()
Subject.Definition = new IndexerDefinition()
{
Name = "Eztv",
Settings = new EztvSettings()
Settings = new EztvSettings { BaseUrl = "https://www.ezrss.it/" }
};
}

View file

@ -117,6 +117,7 @@
<Compile Include="Datastore\MappingExtentionFixture.cs" />
<Compile Include="Datastore\MarrDataLazyLoadingFixture.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\070_delay_profileFixture.cs" />
<Compile Include="Datastore\ObjectDatabaseFixture.cs" />

View file

@ -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%'");
}
}
}

View file

@ -21,10 +21,10 @@ public class EztvSettings : IProviderConfig
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 ValidationResult Validate()

View file

@ -232,6 +232,7 @@
<Compile Include="Datastore\Migration\069_quality_proper.cs" />
<Compile Include="Datastore\Migration\071_unknown_quality_in_profile.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\070_delay_profile.cs" />
<Compile Include="Datastore\Migration\Framework\MigrationContext.cs" />