From 75cbdcd526eefa44f510d7fa676b5af6cce93a2b Mon Sep 17 00:00:00 2001 From: Blake Niemyjski Date: Wed, 25 Sep 2024 22:25:29 -0500 Subject: [PATCH] Added missing tests --- docker-compose.yml | 7 +- .../Storage/RootedSshNetStorageTests.cs | 64 +++++++++++-------- .../Storage/SshNetStorageTests.cs | 64 +++++++++++-------- 3 files changed, 83 insertions(+), 52 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 7afada3..6e27dbf 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,11 +1,14 @@ -version: '3.8' - services: sftp: image: atmoz/sftp:latest ports: - "2222:22" command: foundatio:password:::storage + deploy: + resources: + limits: + memory: 128m + ready: image: andrewlock/wait-for-dependencies command: sftp:22 diff --git a/tests/Foundatio.Storage.SshNet.Tests/Storage/RootedSshNetStorageTests.cs b/tests/Foundatio.Storage.SshNet.Tests/Storage/RootedSshNetStorageTests.cs index 5294f59..8350ec9 100644 --- a/tests/Foundatio.Storage.SshNet.Tests/Storage/RootedSshNetStorageTests.cs +++ b/tests/Foundatio.Storage.SshNet.Tests/Storage/RootedSshNetStorageTests.cs @@ -22,31 +22,6 @@ protected override IFileStorage GetStorage() return new ScopedFileStorage(new SshNetFileStorage(o => o.ConnectionString(connectionString).LoggerFactory(Log)), "/storage"); } - [Fact] - public void CanCreateSshNetFileStorageWithoutConnectionStringPassword() - { - //Arrange - var options = new SshNetFileStorageOptionsBuilder() - .ConnectionString("sftp://username@host") - .Build(); - - //Act - var storage = new SshNetFileStorage(options); - } - - [Fact] - public void CanCreateSshNetFileStorageWithoutProxyPassword() - { - //Arrange - var options = new SshNetFileStorageOptionsBuilder() - .ConnectionString("sftp://username@host") - .Proxy("proxy://username@host") - .Build(); - - //Act - var storage = new SshNetFileStorage(options); - } - [Fact] public override Task CanGetEmptyFileListOnMissingDirectoryAsync() { @@ -161,6 +136,45 @@ public override Task WillRespectStreamOffsetAsync() return base.WillRespectStreamOffsetAsync(); } + [Fact(Skip = "Write Stream is not yet supported")] + public override Task WillWriteStreamContentAsync() + { + return base.WillWriteStreamContentAsync(); + } + + [Fact] + public override Task CanSaveOverExistingStoredContent() + { + return base.CanSaveOverExistingStoredContent(); + } + + [Fact] + public void CanCreateSshNetFileStorageWithoutConnectionStringPassword() + { + //Arrange + var options = new SshNetFileStorageOptionsBuilder() + .ConnectionString("sftp://username@host") + .Build(); + + //Act + var storage = new SshNetFileStorage(options); + Assert.NotNull(storage); + } + + [Fact] + public void CanCreateSshNetFileStorageWithoutProxyPassword() + { + //Arrange + var options = new SshNetFileStorageOptionsBuilder() + .ConnectionString("sftp://username@host") + .Proxy("proxy://username@host") + .Build(); + + //Act + var storage = new SshNetFileStorage(options); + Assert.NotNull(storage); + } + [Fact] public virtual async Task WillNotReturnDirectoryInGetPagedFileListAsync() { diff --git a/tests/Foundatio.Storage.SshNet.Tests/Storage/SshNetStorageTests.cs b/tests/Foundatio.Storage.SshNet.Tests/Storage/SshNetStorageTests.cs index 19be7f8..357bdbf 100644 --- a/tests/Foundatio.Storage.SshNet.Tests/Storage/SshNetStorageTests.cs +++ b/tests/Foundatio.Storage.SshNet.Tests/Storage/SshNetStorageTests.cs @@ -22,31 +22,6 @@ protected override IFileStorage GetStorage() return new ScopedFileStorage(new SshNetFileStorage(o => o.ConnectionString(connectionString).LoggerFactory(Log)), "storage"); } - [Fact] - public void CanCreateSshNetFileStorageWithoutConnectionStringPassword() - { - //Arrange - var options = new SshNetFileStorageOptionsBuilder() - .ConnectionString("sftp://username@host") - .Build(); - - //Act - var storage = new SshNetFileStorage(options); - } - - [Fact] - public void CanCreateSshNetFileStorageWithoutProxyPassword() - { - //Arrange - var options = new SshNetFileStorageOptionsBuilder() - .ConnectionString("sftp://username@host") - .Proxy("proxy://username@host") - .Build(); - - //Act - var storage = new SshNetFileStorage(options); - } - [Fact] public override Task CanGetEmptyFileListOnMissingDirectoryAsync() { @@ -161,6 +136,45 @@ public override Task WillRespectStreamOffsetAsync() return base.WillRespectStreamOffsetAsync(); } + [Fact(Skip = "Write Stream is not yet supported")] + public override Task WillWriteStreamContentAsync() + { + return base.WillWriteStreamContentAsync(); + } + + [Fact] + public override Task CanSaveOverExistingStoredContent() + { + return base.CanSaveOverExistingStoredContent(); + } + + [Fact] + public void CanCreateSshNetFileStorageWithoutConnectionStringPassword() + { + //Arrange + var options = new SshNetFileStorageOptionsBuilder() + .ConnectionString("sftp://username@host") + .Build(); + + //Act + var storage = new SshNetFileStorage(options); + Assert.NotNull(storage); + } + + [Fact] + public void CanCreateSshNetFileStorageWithoutProxyPassword() + { + //Arrange + var options = new SshNetFileStorageOptionsBuilder() + .ConnectionString("sftp://username@host") + .Proxy("proxy://username@host") + .Build(); + + //Act + var storage = new SshNetFileStorage(options); + Assert.NotNull(storage); + } + [Fact] public virtual async Task WillNotReturnDirectoryInGetPagedFileListAsync() {