mirror of
https://github.com/Sonarr/Sonarr
synced 2025-03-04 02:28:21 +00:00
Fixed: Health warning for downloading inside root folders
This commit is contained in:
parent
413d6b996b
commit
bb0ad312f1
2 changed files with 16 additions and 3 deletions
|
@ -76,6 +76,19 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
|||
Subject.Check().ShouldBeWarning();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_warning_if_downloading_inside_root_folder()
|
||||
{
|
||||
var rootFolderPath = "c:\\Test".AsOsAgnostic();
|
||||
var downloadRootPath = "c:\\Test\\Downloads".AsOsAgnostic();
|
||||
|
||||
GivenRootFolder(rootFolderPath);
|
||||
|
||||
_clientStatus.OutputRootFolders = new List<OsPath> { new (downloadRootPath) };
|
||||
|
||||
Subject.Check().ShouldBeWarning();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_ok_if_not_downloading_to_root_folder()
|
||||
{
|
||||
|
@ -87,7 +100,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
|||
}
|
||||
|
||||
[Test]
|
||||
[TestCaseSource("DownloadClientExceptions")]
|
||||
[TestCaseSource(nameof(DownloadClientExceptions))]
|
||||
public void should_return_ok_if_client_throws_downloadclientexception(Exception ex)
|
||||
{
|
||||
_downloadClient.Setup(s => s.GetStatus())
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
|||
try
|
||||
{
|
||||
var status = client.GetStatus();
|
||||
var folders = status.OutputRootFolders.Where(folder => rootFolders.Any(r => r.Path.PathEquals(folder.FullPath)));
|
||||
var folders = rootFolders.Where(r => status.OutputRootFolders.Any(folder => r.Path.PathEquals(folder.FullPath) || r.Path.IsParentPath(folder.FullPath)));
|
||||
|
||||
foreach (var folder in folders)
|
||||
{
|
||||
|
@ -57,7 +57,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
|
|||
_localizationService.GetLocalizedString("DownloadClientRootFolderHealthCheckMessage", new Dictionary<string, object>
|
||||
{
|
||||
{ "downloadClientName", client.Definition.Name },
|
||||
{ "rootFolderPath", folder.FullPath }
|
||||
{ "rootFolderPath", folder.Path }
|
||||
}),
|
||||
"#downloads-in-root-folder");
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue