|
|
@ -7,6 +7,7 @@ using NzbDrone.Core.HealthCheck.Checks;
|
|
|
|
using NzbDrone.Core.Localization;
|
|
|
|
using NzbDrone.Core.Localization;
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
using NzbDrone.Core.Update;
|
|
|
|
using NzbDrone.Core.Update;
|
|
|
|
|
|
|
|
using NzbDrone.Test.Common;
|
|
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Test.HealthCheck.Checks
|
|
|
|
namespace NzbDrone.Core.Test.HealthCheck.Checks
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -21,28 +22,10 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
|
|
|
.Returns("Some Warning Message");
|
|
|
|
.Returns("Some Warning Message");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
|
|
public void should_return_error_when_app_folder_is_write_protected()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
WindowsOnly();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IAppFolderInfo>()
|
|
|
|
|
|
|
|
.Setup(s => s.StartUpFolder)
|
|
|
|
|
|
|
|
.Returns(@"C:\NzbDrone");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IDiskProvider>()
|
|
|
|
|
|
|
|
.Setup(c => c.FolderWritable(It.IsAny<string>()))
|
|
|
|
|
|
|
|
.Returns(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Subject.Check().ShouldBeError();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void should_return_error_when_app_folder_is_write_protected_and_update_automatically_is_enabled()
|
|
|
|
public void should_return_error_when_app_folder_is_write_protected_and_update_automatically_is_enabled()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
PosixOnly();
|
|
|
|
var startupFolder = @"C:\NzbDrone".AsOsAgnostic();
|
|
|
|
|
|
|
|
|
|
|
|
const string startupFolder = @"/opt/nzbdrone";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IConfigFileProvider>()
|
|
|
|
Mocker.GetMock<IConfigFileProvider>()
|
|
|
|
.Setup(s => s.UpdateAutomatically)
|
|
|
|
.Setup(s => s.UpdateAutomatically)
|
|
|
@ -62,10 +45,8 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void should_return_error_when_ui_folder_is_write_protected_and_update_automatically_is_enabled()
|
|
|
|
public void should_return_error_when_ui_folder_is_write_protected_and_update_automatically_is_enabled()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
PosixOnly();
|
|
|
|
var startupFolder = @"C:\NzbDrone".AsOsAgnostic();
|
|
|
|
|
|
|
|
var uiFolder = @"C:\NzbDrone\UI".AsOsAgnostic();
|
|
|
|
const string startupFolder = @"/opt/nzbdrone";
|
|
|
|
|
|
|
|
const string uiFolder = @"/opt/nzbdrone/UI";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IConfigFileProvider>()
|
|
|
|
Mocker.GetMock<IConfigFileProvider>()
|
|
|
|
.Setup(s => s.UpdateAutomatically)
|
|
|
|
.Setup(s => s.UpdateAutomatically)
|
|
|
@ -89,7 +70,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void should_not_return_error_when_app_folder_is_write_protected_and_external_script_enabled()
|
|
|
|
public void should_not_return_error_when_app_folder_is_write_protected_and_external_script_enabled()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
PosixOnly();
|
|
|
|
var startupFolder = @"C:\NzbDrone".AsOsAgnostic();
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IConfigFileProvider>()
|
|
|
|
Mocker.GetMock<IConfigFileProvider>()
|
|
|
|
.Setup(s => s.UpdateAutomatically)
|
|
|
|
.Setup(s => s.UpdateAutomatically)
|
|
|
@ -101,7 +82,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IAppFolderInfo>()
|
|
|
|
Mocker.GetMock<IAppFolderInfo>()
|
|
|
|
.Setup(s => s.StartUpFolder)
|
|
|
|
.Setup(s => s.StartUpFolder)
|
|
|
|
.Returns(@"/opt/nzbdrone");
|
|
|
|
.Returns(startupFolder);
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IDiskProvider>()
|
|
|
|
Mocker.GetMock<IDiskProvider>()
|
|
|
|
.Verify(c => c.FolderWritable(It.IsAny<string>()), Times.Never());
|
|
|
|
.Verify(c => c.FolderWritable(It.IsAny<string>()), Times.Never());
|
|
|
|