1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00

Continue Test in case of validation warnings.

This commit is contained in:
Taloth Saldono 2019-03-24 15:22:50 +01:00
parent cab900f656
commit eb2e7b9c79
11 changed files with 30 additions and 10 deletions

View File

@ -198,7 +198,7 @@ public override DownloadClientInfo GetStatus()
protected override void Test(List<ValidationFailure> failures)
{
failures.AddIfNotNull(TestConnection());
if (failures.Any()) return;
if (failures.HasErrors()) return;
failures.AddIfNotNull(TestCategory());
failures.AddIfNotNull(TestGetTorrents());
}

View File

@ -194,7 +194,7 @@ protected override string AddFromTorrentFile(RemoteEpisode remoteEpisode, string
protected override void Test(List<ValidationFailure> failures)
{
failures.AddIfNotNull(TestConnection());
if (failures.Any()) return;
if (failures.HasErrors()) return;
failures.AddIfNotNull(TestOutputPath());
failures.AddIfNotNull(TestGetTorrents());
}

View File

@ -189,7 +189,7 @@ protected override string AddFromNzbFile(RemoteEpisode remoteEpisode, string fil
protected override void Test(List<ValidationFailure> failures)
{
failures.AddIfNotNull(TestConnection());
if (failures.Any()) return;
if (failures.HasErrors()) return;
failures.AddIfNotNull(TestOutputPath());
failures.AddIfNotNull(TestGetNZB());
}

View File

@ -130,7 +130,7 @@ public override DownloadClientInfo GetStatus()
protected override void Test(List<ValidationFailure> failures)
{
failures.AddIfNotNull(TestConnection());
if (failures.Any()) return;
if (failures.HasErrors()) return;
failures.AddIfNotNull(TestGetTorrents());
}

View File

@ -215,7 +215,7 @@ public override DownloadClientInfo GetStatus()
protected override void Test(List<ValidationFailure> failures)
{
failures.AddIfNotNull(TestConnection());
if (failures.Any()) return;
if (failures.HasErrors()) return;
failures.AddIfNotNull(TestPrioritySupport());
failures.AddIfNotNull(TestGetTorrents());
}

View File

@ -165,7 +165,7 @@ protected override string AddFromTorrentFile(RemoteEpisode remoteEpisode, string
protected override void Test(List<ValidationFailure> failures)
{
failures.AddIfNotNull(TestConnection());
if (failures.Any()) return;
if (failures.HasErrors()) return;
failures.AddIfNotNull(TestGetTorrents());
}

View File

@ -163,7 +163,7 @@ public override DownloadClientInfo GetStatus()
protected override void Test(List<ValidationFailure> failures)
{
failures.AddIfNotNull(TestConnection());
if (failures.Any()) return;
if (failures.HasErrors()) return;
failures.AddIfNotNull(TestGetTorrents());
failures.AddIfNotNull(TestDirectory());
}

View File

@ -224,7 +224,7 @@ public override DownloadClientInfo GetStatus()
protected override void Test(List<ValidationFailure> failures)
{
failures.AddIfNotNull(TestConnection());
if (failures.Any()) return;
if (failures.HasErrors()) return;
failures.AddIfNotNull(TestGetTorrents());
}

View File

@ -8,6 +8,7 @@
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Parser;
using NzbDrone.Core.ThingiProvider;
using NzbDrone.Core.Validation;
namespace NzbDrone.Core.Indexers.Newznab
{
@ -102,7 +103,7 @@ private NewznabSettings GetSettings(string url, string apiPath = null, int[] cat
protected override void Test(List<ValidationFailure> failures)
{
base.Test(failures);
if (failures.Any()) return;
if (failures.HasErrors()) return;
failures.AddIfNotNull(TestCapabilities());
}

View File

@ -9,6 +9,7 @@
using NzbDrone.Core.Indexers.Newznab;
using NzbDrone.Core.Parser;
using NzbDrone.Core.ThingiProvider;
using NzbDrone.Core.Validation;
namespace NzbDrone.Core.Indexers.Torznab
{
@ -91,7 +92,7 @@ private TorznabSettings GetSettings(string url, string apiPath = null, int[] cat
protected override void Test(List<ValidationFailure> failures)
{
base.Test(failures);
if (failures.Any()) return;
if (failures.HasErrors()) return;
failures.AddIfNotNull(TestCapabilities());
}

View File

@ -1,5 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using FluentValidation;
using FluentValidation.Results;
namespace NzbDrone.Core.Validation
{
@ -19,5 +21,21 @@ public static void ThrowOnError(this NzbDroneValidationResult result)
throw new ValidationException(result.Errors);
}
}
public static bool HasErrors(this List<ValidationFailure> list)
{
foreach (var item in list)
{
var extended = item as NzbDroneValidationFailure;
if (extended != null && extended.IsWarning)
{
continue;
}
return true;
}
return false;
}
}
}