RemotePathMappingCheck Improvements
This commit is contained in:
parent
202449c40c
commit
1f20bc63c6
|
@ -28,7 +28,7 @@ namespace NzbDrone.Core.Test.Download
|
||||||
_downloadClients = new List<IDownloadClient>();
|
_downloadClients = new List<IDownloadClient>();
|
||||||
|
|
||||||
Mocker.GetMock<IProvideDownloadClient>()
|
Mocker.GetMock<IProvideDownloadClient>()
|
||||||
.Setup(v => v.GetDownloadClients())
|
.Setup(v => v.GetDownloadClients(It.IsAny<bool>()))
|
||||||
.Returns(_downloadClients);
|
.Returns(_downloadClients);
|
||||||
|
|
||||||
Mocker.GetMock<IProvideDownloadClient>()
|
Mocker.GetMock<IProvideDownloadClient>()
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Core.Download;
|
using NzbDrone.Core.Download;
|
||||||
using NzbDrone.Core.HealthCheck.Checks;
|
using NzbDrone.Core.HealthCheck.Checks;
|
||||||
|
@ -14,7 +15,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||||
public void should_return_warning_when_download_client_has_not_been_configured()
|
public void should_return_warning_when_download_client_has_not_been_configured()
|
||||||
{
|
{
|
||||||
Mocker.GetMock<IProvideDownloadClient>()
|
Mocker.GetMock<IProvideDownloadClient>()
|
||||||
.Setup(s => s.GetDownloadClients())
|
.Setup(s => s.GetDownloadClients(It.IsAny<bool>()))
|
||||||
.Returns(Array.Empty<IDownloadClient>());
|
.Returns(Array.Empty<IDownloadClient>());
|
||||||
|
|
||||||
Subject.Check().ShouldBeWarning();
|
Subject.Check().ShouldBeWarning();
|
||||||
|
@ -30,7 +31,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||||
.Throws<Exception>();
|
.Throws<Exception>();
|
||||||
|
|
||||||
Mocker.GetMock<IProvideDownloadClient>()
|
Mocker.GetMock<IProvideDownloadClient>()
|
||||||
.Setup(s => s.GetDownloadClients())
|
.Setup(s => s.GetDownloadClients(It.IsAny<bool>()))
|
||||||
.Returns(new IDownloadClient[] { downloadClient.Object });
|
.Returns(new IDownloadClient[] { downloadClient.Object });
|
||||||
|
|
||||||
Subject.Check().ShouldBeError();
|
Subject.Check().ShouldBeError();
|
||||||
|
@ -45,7 +46,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||||
.Returns(new List<DownloadClientItem>());
|
.Returns(new List<DownloadClientItem>());
|
||||||
|
|
||||||
Mocker.GetMock<IProvideDownloadClient>()
|
Mocker.GetMock<IProvideDownloadClient>()
|
||||||
.Setup(s => s.GetDownloadClients())
|
.Setup(s => s.GetDownloadClients(It.IsAny<bool>()))
|
||||||
.Returns(new IDownloadClient[] { downloadClient.Object });
|
.Returns(new IDownloadClient[] { downloadClient.Object });
|
||||||
|
|
||||||
Subject.Check().ShouldBeOk();
|
Subject.Check().ShouldBeOk();
|
||||||
|
|
|
@ -44,7 +44,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||||
.Returns(_clientStatus);
|
.Returns(_clientStatus);
|
||||||
|
|
||||||
Mocker.GetMock<IProvideDownloadClient>()
|
Mocker.GetMock<IProvideDownloadClient>()
|
||||||
.Setup(s => s.GetDownloadClients())
|
.Setup(s => s.GetDownloadClients(It.IsAny<bool>()))
|
||||||
.Returns(new IDownloadClient[] { _downloadClient.Object });
|
.Returns(new IDownloadClient[] { _downloadClient.Object });
|
||||||
|
|
||||||
Mocker.GetMock<IDiskProvider>()
|
Mocker.GetMock<IDiskProvider>()
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||||
.Returns(_clientStatus);
|
.Returns(_clientStatus);
|
||||||
|
|
||||||
Mocker.GetMock<IProvideDownloadClient>()
|
Mocker.GetMock<IProvideDownloadClient>()
|
||||||
.Setup(s => s.GetDownloadClients())
|
.Setup(s => s.GetDownloadClients(It.IsAny<bool>()))
|
||||||
.Returns(new IDownloadClient[] { _downloadClient.Object });
|
.Returns(new IDownloadClient[] { _downloadClient.Object });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||||
.Returns(_clientStatus);
|
.Returns(_clientStatus);
|
||||||
|
|
||||||
Mocker.GetMock<IProvideDownloadClient>()
|
Mocker.GetMock<IProvideDownloadClient>()
|
||||||
.Setup(s => s.GetDownloadClients())
|
.Setup(s => s.GetDownloadClients(It.IsAny<bool>()))
|
||||||
.Returns(new IDownloadClient[] { _downloadClient.Object });
|
.Returns(new IDownloadClient[] { _downloadClient.Object });
|
||||||
|
|
||||||
Mocker.GetMock<IConfigService>()
|
Mocker.GetMock<IConfigService>()
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only check clients not in failure status, those get another message
|
// Only check clients not in failure status, those get another message
|
||||||
var clients = _downloadClientProvider.GetDownloadClients();
|
var clients = _downloadClientProvider.GetDownloadClients(true);
|
||||||
|
|
||||||
foreach (var client in clients)
|
foreach (var client in clients)
|
||||||
{
|
{
|
||||||
|
@ -143,7 +143,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
||||||
// If the previous case did not match then the failure occured in DownloadedEpisodeImportService,
|
// If the previous case did not match then the failure occured in DownloadedEpisodeImportService,
|
||||||
// while trying to locate the files reported by the download client
|
// while trying to locate the files reported by the download client
|
||||||
// Only check clients not in failure status, those get another message
|
// Only check clients not in failure status, those get another message
|
||||||
var client = _downloadClientProvider.GetDownloadClients().FirstOrDefault(x => x.Definition.Name == failureMessage.DownloadClientInfo.Name);
|
var client = _downloadClientProvider.GetDownloadClients(true).FirstOrDefault(x => x.Definition.Name == failureMessage.DownloadClientInfo.Name);
|
||||||
|
|
||||||
if (client == null)
|
if (client == null)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue