Continue Test in case of validation warnings.

pull/6/head
Taloth Saldono 6 years ago committed by Qstick
parent 5a1ca9a42f
commit 5d066ed5d4

@ -197,7 +197,7 @@ namespace NzbDrone.Core.Download.Clients.Deluge
protected override void Test(List<ValidationFailure> failures)
{
failures.AddIfNotNull(TestConnection());
if (failures.Any()) return;
if (failures.HasErrors()) return;
failures.AddIfNotNull(TestCategory());
failures.AddIfNotNull(TestGetTorrents());
}

@ -197,7 +197,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
protected override void Test(List<ValidationFailure> failures)
{
failures.AddIfNotNull(TestConnection());
if (failures.Any()) return;
if (failures.HasErrors()) return;
failures.AddIfNotNull(TestOutputPath());
failures.AddIfNotNull(TestGetTorrents());
}

@ -192,7 +192,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation
protected override void Test(List<ValidationFailure> failures)
{
failures.AddIfNotNull(TestConnection());
if (failures.Any()) return;
if (failures.HasErrors()) return;
failures.AddIfNotNull(TestOutputPath());
failures.AddIfNotNull(TestGetNZB());
}

@ -130,7 +130,7 @@ namespace NzbDrone.Core.Download.Clients.Hadouken
protected override void Test(List<ValidationFailure> failures)
{
failures.AddIfNotNull(TestConnection());
if (failures.Any()) return;
if (failures.HasErrors()) return;
failures.AddIfNotNull(TestGetTorrents());
}

@ -215,10 +215,7 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent
protected override void Test(List<ValidationFailure> failures)
{
failures.AddIfNotNull(TestConnection());
if (failures.Any())
{
return;
}
if (failures.HasErrors()) return;
failures.AddIfNotNull(TestPrioritySupport());
failures.AddIfNotNull(TestGetTorrents());
}

@ -165,7 +165,7 @@ namespace NzbDrone.Core.Download.Clients.Transmission
protected override void Test(List<ValidationFailure> failures)
{
failures.AddIfNotNull(TestConnection());
if (failures.Any()) return;
if (failures.HasErrors()) return;
failures.AddIfNotNull(TestGetTorrents());
}

@ -163,7 +163,7 @@ namespace NzbDrone.Core.Download.Clients.RTorrent
protected override void Test(List<ValidationFailure> failures)
{
failures.AddIfNotNull(TestConnection());
if (failures.Any()) return;
if (failures.HasErrors()) return;
failures.AddIfNotNull(TestGetTorrents());
failures.AddIfNotNull(TestDirectory());
}

@ -224,7 +224,7 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
protected override void Test(List<ValidationFailure> failures)
{
failures.AddIfNotNull(TestConnection());
if (failures.Any()) return;
if (failures.HasErrors()) return;
failures.AddIfNotNull(TestGetTorrents());
}

@ -8,6 +8,7 @@ using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Parser;
using NzbDrone.Core.ThingiProvider;
using NzbDrone.Core.Validation;
namespace NzbDrone.Core.Indexers.Newznab
{
@ -91,8 +92,7 @@ namespace NzbDrone.Core.Indexers.Newznab
protected override void Test(List<ValidationFailure> failures)
{
base.Test(failures);
if (failures.Any()) return;
if (failures.HasErrors()) return;
failures.AddIfNotNull(TestCapabilities());
}

@ -9,6 +9,7 @@ using NzbDrone.Core.Configuration;
using NzbDrone.Core.Indexers.Newznab;
using NzbDrone.Core.Parser;
using NzbDrone.Core.ThingiProvider;
using NzbDrone.Core.Validation;
namespace NzbDrone.Core.Indexers.Torznab
{
@ -72,8 +73,7 @@ namespace NzbDrone.Core.Indexers.Torznab
protected override void Test(List<ValidationFailure> failures)
{
base.Test(failures);
if (failures.Any()) return;
if (failures.HasErrors()) return;
failures.AddIfNotNull(TestCapabilities());
}

@ -1,5 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using FluentValidation;
using FluentValidation.Results;
namespace NzbDrone.Core.Validation
{
@ -19,5 +21,21 @@ namespace NzbDrone.Core.Validation
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;
}
}
}

Loading…
Cancel
Save