Skip to content

Commit

Permalink
SNOW-990111: Modify config finder tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-lf committed Jan 24, 2024
1 parent eff9425 commit f708021
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ public void TestThatTakesFilePathFromHomeDirectoryWhenNoOtherWaysPossible()
}

[Test]
[Ignore("TODO: modify the test and remove Ignore")]
public void TestThatConfigFileIsNotUsedIfOthersCanModifyTheConfigFile()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
Expand All @@ -130,6 +129,8 @@ public void TestThatConfigFileIsNotUsedIfOthersCanModifyTheConfigFile()

// arrange
var configFilePath = CreateConfigTempFile(Config(EasyLoggingLogLevel.Warn.ToString(), InputConfigFilePath));
var fileInfo = new Mono.Unix.UnixFileInfo(InputConfigFilePath);
fileInfo.Create(Mono.Unix.FileAccessPermissions.AllPermissions);

// act
var thrown = Assert.Throws<Exception>(() => t_finder.FindConfigFilePath(configFilePath));
Expand Down Expand Up @@ -166,6 +167,20 @@ public void TestThatDoesNotFailWhenSearchForOneOfDirectoriesFails()
t_environmentOperations.Verify(e => e.GetFolderPath(Environment.SpecialFolder.UserProfile), Times.Once);
}

[Test]
public void TestThatDoesNotFailWhenHomeDirectoryReturnsNull()
{
// arrange
MockHomeDirectoryReturnsNull();

// act
var filePath = t_finder.FindConfigFilePath(null);

// assert
Assert.IsNull(filePath);
t_environmentOperations.Verify(e => e.GetFolderPath(Environment.SpecialFolder.UserProfile), Times.Once);
}

[Test]
public void TestThatDoesNotFailWhenHomeDirectoryDoesNotExist()
{
Expand Down

0 comments on commit f708021

Please sign in to comment.