mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-20 21:55:03 -04:00
new: smarter validation for newznab indexer settings
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Indexers.Newznab;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
|
||||
{
|
||||
public class NewznabSettingFixture : CoreTest
|
||||
{
|
||||
|
||||
[TestCase("http://nzbs.org")]
|
||||
[TestCase("http:///www.nzbplanet.net")]
|
||||
public void requires_apikey(string url)
|
||||
{
|
||||
var setting = new NewznabSettings()
|
||||
{
|
||||
ApiKey = "",
|
||||
Url = url
|
||||
};
|
||||
|
||||
|
||||
setting.Validate().IsValid.Should().BeFalse();
|
||||
setting.Validate().Errors.Should().Contain(c => c.PropertyName == "ApiKey");
|
||||
|
||||
}
|
||||
|
||||
|
||||
[TestCase("http://nzbs2.org")]
|
||||
public void doesnt_requires_apikey(string url)
|
||||
{
|
||||
var setting = new NewznabSettings()
|
||||
{
|
||||
ApiKey = "",
|
||||
Url = url
|
||||
};
|
||||
|
||||
|
||||
setting.Validate().IsValid.Should().BeTrue();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user