Fixed: Rework RSS Check to Enabled Check

pull/32/head
Qstick 4 years ago
parent 01415e4b7e
commit ea8ceaebb3

@ -9,7 +9,7 @@ using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.HealthCheck.Checks
{
[TestFixture]
public class IndexerRssCheckFixture : CoreTest<IndexerRssCheck>
public class IndexerCheckFixture : CoreTest<IndexerCheck>
{
private Mock<IIndexer> _indexerMock;
@ -47,17 +47,6 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
.Returns(new List<IIndexer> { _indexerMock.Object });
}
private void GivenRssFiltered()
{
Mocker.GetMock<IIndexerFactory>()
.Setup(s => s.Enabled(false))
.Returns(new List<IIndexer> { _indexerMock.Object });
Mocker.GetMock<ILocalizationService>()
.Setup(s => s.GetLocalizedString(It.IsAny<string>()))
.Returns("recent indexer errors");
}
[Test]
public void should_return_error_when_no_indexer_present()
{
@ -88,14 +77,5 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
Subject.Check().ShouldBeError();
}
[Test]
public void should_return_filter_warning_if_rss_is_enabled_but_filtered()
{
GivenIndexer(true, false);
GivenRssFiltered();
Subject.Check().ShouldBeWarning("recent indexer errors");
}
}
}

@ -9,11 +9,11 @@ namespace NzbDrone.Core.HealthCheck.Checks
[CheckOn(typeof(ProviderUpdatedEvent<IIndexer>))]
[CheckOn(typeof(ProviderDeletedEvent<IIndexer>))]
[CheckOn(typeof(ProviderStatusChangedEvent<IIndexer>))]
public class IndexerRssCheck : HealthCheckBase
public class IndexerCheck : HealthCheckBase
{
private readonly IIndexerFactory _indexerFactory;
public IndexerRssCheck(IIndexerFactory indexerFactory, ILocalizationService localizationService)
public IndexerCheck(IIndexerFactory indexerFactory, ILocalizationService localizationService)
: base(localizationService)
{
_indexerFactory = indexerFactory;
@ -25,14 +25,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
if (enabled.Empty())
{
return new HealthCheck(GetType(), HealthCheckResult.Error, _localizationService.GetLocalizedString("IndexerRssHealthCheckNoIndexers"));
}
var active = _indexerFactory.Enabled(true);
if (active.Empty())
{
return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerRssHealthCheckNoAvailableIndexers"));
return new HealthCheck(GetType(), HealthCheckResult.Error, _localizationService.GetLocalizedString("IndexerHealthCheckNoIndexers"));
}
return new HealthCheck(GetType());

@ -147,8 +147,7 @@
"IndexerPriority": "Indexer Priority",
"IndexerPriorityHelpText": "Indexer Priority from 1 (Highest) to 50 (Lowest). Default: 25.",
"IndexerQuery": "Indexer Query",
"IndexerRssHealthCheckNoAvailableIndexers": "All rss-capable indexers are temporarily unavailable due to recent indexer errors",
"IndexerRssHealthCheckNoIndexers": "No indexers available with RSS sync enabled, Prowlarr will not grab new releases automatically",
"IndexerHealthCheckNoIndexers": "No indexers enabled, Prowlarr will not return search results",
"Indexers": "Indexers",
"IndexersSelectedInterp": "{0} Indexer(s) Selected",
"IndexerStatusCheckAllClientMessage": "All indexers are unavailable due to failures",

Loading…
Cancel
Save