Skip to content

Commit

Permalink
Added missing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
niemyjski committed Sep 26, 2024
1 parent d28a3f5 commit 75cbdcd
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 52 deletions.
7 changes: 5 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down Expand Up @@ -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()

Check failure on line 146 in tests/Foundatio.Storage.SshNet.Tests/Storage/RootedSshNetStorageTests.cs

View workflow job for this annotation

GitHub Actions / build / build

'RootedSshNetStorageTests.CanSaveOverExistingStoredContent()': no suitable method found to override

Check failure on line 146 in tests/Foundatio.Storage.SshNet.Tests/Storage/RootedSshNetStorageTests.cs

View workflow job for this annotation

GitHub Actions / build / build

'RootedSshNetStorageTests.CanSaveOverExistingStoredContent()': no suitable method found to override
{
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()
{
Expand Down
64 changes: 39 additions & 25 deletions tests/Foundatio.Storage.SshNet.Tests/Storage/SshNetStorageTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down Expand Up @@ -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()

Check failure on line 146 in tests/Foundatio.Storage.SshNet.Tests/Storage/SshNetStorageTests.cs

View workflow job for this annotation

GitHub Actions / build / build

'SshNetStorageTests.CanSaveOverExistingStoredContent()': no suitable method found to override

Check failure on line 146 in tests/Foundatio.Storage.SshNet.Tests/Storage/SshNetStorageTests.cs

View workflow job for this annotation

GitHub Actions / build / build

'SshNetStorageTests.CanSaveOverExistingStoredContent()': no suitable method found to override
{
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()
{
Expand Down

0 comments on commit 75cbdcd

Please sign in to comment.