mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
Newznab providers will be compared based on url, not name.
Built-in Newznab providers cannot be deleted (they would be re-added anyways), nor can the URL be changed.
This commit is contained in:
parent
b7fea36045
commit
b930eb0993
7 changed files with 79 additions and 14 deletions
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
|
@ -216,6 +217,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
//Assert
|
||||
var result = db.Fetch<NewznabDefinition>();
|
||||
result.Should().HaveCount(5);
|
||||
result.Should().OnlyContain(i => i.BuiltIn);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -236,16 +238,39 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
Mocker.SetConstant(db);
|
||||
|
||||
db.Insert(definitions[0]);
|
||||
db.Insert(definitions[1]);
|
||||
db.Insert(definitions[2]);
|
||||
|
||||
//Act
|
||||
Mocker.Resolve<NewznabProvider>().InitializeNewznabIndexers(definitions);
|
||||
|
||||
//Assert
|
||||
var result = db.Fetch<NewznabDefinition>();
|
||||
result.Should().HaveCount(5);
|
||||
result.Where(d => d.Url == "http://www.nzbdrone.com").Should().HaveCount(3);
|
||||
result.Where(d => d.Url == "http://www.nzbdrone2.com").Should().HaveCount(2);
|
||||
result.Should().HaveCount(2);
|
||||
result.Where(d => d.Url == "http://www.nzbdrone.com").Should().HaveCount(1);
|
||||
result.Where(d => d.Url == "http://www.nzbdrone2.com").Should().HaveCount(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void InitializeNewznabIndexers_should_update_matching_indexer_to_be_builtin()
|
||||
{
|
||||
//Setup
|
||||
var definition = Builder<NewznabDefinition>.CreateNew()
|
||||
.With(d => d.Url = "http://www.nzbdrone2.com")
|
||||
.With(d => d.BuiltIn = false)
|
||||
.Build();
|
||||
|
||||
var db = TestDbHelper.GetEmptyDatabase();
|
||||
Mocker.SetConstant(db);
|
||||
|
||||
db.Insert(definition);
|
||||
|
||||
//Act
|
||||
Mocker.Resolve<NewznabProvider>().InitializeNewznabIndexers(new List<NewznabDefinition>{ definition });
|
||||
|
||||
//Assert
|
||||
var result = db.Fetch<NewznabDefinition>();
|
||||
result.Should().HaveCount(1);
|
||||
result.First().BuiltIn.Should().BeTrue();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue