mirror of https://github.com/Sonarr/Sonarr
Merge pull request #653 from Sonarr/kickass-url-update
Update the kickass url to https://kat.cr
This commit is contained in:
commit
102f2e39be
|
@ -0,0 +1,66 @@
|
|||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Serializer;
|
||||
using NzbDrone.Core.Datastore.Migration;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Indexers.KickassTorrents;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.Datastore.Migration
|
||||
{
|
||||
[TestFixture]
|
||||
public class update_kickass_url_migration_fixture : MigrationTest<update_kickass_url>
|
||||
{
|
||||
[TestCase("http://kickass.so")]
|
||||
[TestCase("https://kickass.so")]
|
||||
[TestCase("http://kickass.to")]
|
||||
[TestCase("https://kickass.to")]
|
||||
[TestCase("http://kat.cr")]
|
||||
// [TestCase("HTTP://KICKASS.SO")] Not sure if there is an easy way to do this, not sure if worth it.
|
||||
public void should_replace_old_url(string oldUrl)
|
||||
{
|
||||
WithTestDb(c =>
|
||||
{
|
||||
c.Insert.IntoTable("Indexers").Row(new
|
||||
{
|
||||
Name = "Kickass_wrong_url",
|
||||
Implementation = "KickassTorrents",
|
||||
Settings = new KickassTorrentsSettings
|
||||
{
|
||||
BaseUrl = oldUrl
|
||||
}.ToJson(),
|
||||
ConfigContract = "KickassTorrentsSettings"
|
||||
});
|
||||
});
|
||||
|
||||
var items = Mocker.Resolve<IndexerRepository>().All().ToList();
|
||||
|
||||
items.Should().HaveCount(1);
|
||||
items.First().Settings.As<KickassTorrentsSettings>().BaseUrl.Should().Be("https://kat.cr");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_replace_other_indexers()
|
||||
{
|
||||
WithTestDb(c =>
|
||||
{
|
||||
c.Insert.IntoTable("Indexers").Row(new
|
||||
{
|
||||
Name = "not_kickass",
|
||||
Implementation = "NotKickassTorrents",
|
||||
Settings = new KickassTorrentsSettings
|
||||
{
|
||||
BaseUrl = "kickass.so",
|
||||
}.ToJson(),
|
||||
ConfigContract = "KickassTorrentsSettings"
|
||||
});
|
||||
});
|
||||
|
||||
var items = Mocker.Resolve<IndexerRepository>().All().ToList();
|
||||
|
||||
items.Should().HaveCount(1);
|
||||
items.First().Settings.As<KickassTorrentsSettings>().BaseUrl.Should().Be("kickass.so");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -127,6 +127,7 @@
|
|||
<Compile Include="Datastore\Migration\081_move_dot_prefix_to_transmission_categoryFixture.cs" />
|
||||
<Compile Include="Datastore\Migration\079_dedupe_tagsFixture.cs" />
|
||||
<Compile Include="Datastore\Migration\075_force_lib_updateFixture.cs" />
|
||||
<Compile Include="Datastore\Migration\089_update_kickass_urlFixture.cs" />
|
||||
<Compile Include="Datastore\ObjectDatabaseFixture.cs" />
|
||||
<Compile Include="Datastore\PagingSpecExtensionsTests\PagingOffsetFixture.cs" />
|
||||
<Compile Include="Datastore\PagingSpecExtensionsTests\ToSortDirectionFixture.cs" />
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
using FluentMigrator;
|
||||
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Datastore.Migration
|
||||
{
|
||||
[Migration(90)]
|
||||
public class update_kickass_url : NzbDroneMigrationBase
|
||||
{
|
||||
protected override void MainDbUpgrade()
|
||||
{
|
||||
Execute.Sql(
|
||||
"UPDATE Indexers SET Settings = Replace(Settings, 'kickass.so', 'kat.cr') WHERE Implementation = 'KickassTorrents';" +
|
||||
"UPDATE Indexers SET Settings = Replace(Settings, 'kickass.to', 'kat.cr') WHERE Implementation = 'KickassTorrents';" +
|
||||
"UPDATE Indexers SET Settings = Replace(Settings, 'http://', 'https://') WHERE Implementation = 'KickassTorrents';"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -20,7 +20,7 @@ namespace NzbDrone.Core.Indexers.KickassTorrents
|
|||
|
||||
public KickassTorrentsSettings()
|
||||
{
|
||||
BaseUrl = "http://kat.cr";
|
||||
BaseUrl = "https://kat.cr";
|
||||
VerifiedOnly = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -263,6 +263,7 @@
|
|||
<Compile Include="Datastore\Migration\083_additonal_blacklist_columns.cs" />
|
||||
<Compile Include="Datastore\Migration\082_add_fanzub_settings.cs" />
|
||||
<Compile Include="Datastore\Migration\088_pushbullet_devices_channels_list.cs" />
|
||||
<Compile Include="Datastore\Migration\089_update_kickass_url.cs" />
|
||||
<Compile Include="Datastore\Migration\Framework\MigrationContext.cs" />
|
||||
<Compile Include="Datastore\Migration\Framework\MigrationController.cs" />
|
||||
<Compile Include="Datastore\Migration\Framework\MigrationDbFactory.cs" />
|
||||
|
|
Loading…
Reference in New Issue