Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
veeso committed Jul 6, 2023
1 parent 9076f36 commit 2cabc17
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/ssh/commons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,13 +338,16 @@ mod test {
#[cfg(feature = "with-containers")]
use crate::mock::ssh as ssh_mock;

#[cfg(feature = "with-containers")]
use ssh2_config::ParseRule;

#[test]
#[cfg(feature = "with-containers")]
fn should_connect_to_ssh_server_auth_user_password() {
crate::mock::logger();
let config_file = ssh_mock::create_ssh_config();
let opts = SshOpts::new("sftp")
.config_file(config_file.path())
.config_file(config_file.path(), ParseRule::ALLOW_UNKNOWN_FIELDS)
.password("password");
let session = connect(&opts).ok().unwrap();
assert!(session.authenticated());
Expand All @@ -356,7 +359,7 @@ mod test {
crate::mock::logger();
let config_file = ssh_mock::create_ssh_config();
let opts = SshOpts::new("sftp")
.config_file(config_file.path())
.config_file(config_file.path(), ParseRule::ALLOW_UNKNOWN_FIELDS)
.key_storage(Box::new(ssh_mock::MockSshKeyStorage::default()));
let session = connect(&opts).ok().unwrap();
assert!(session.authenticated());
Expand Down
5 changes: 4 additions & 1 deletion src/ssh/scp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,9 @@ mod test {
#[cfg(feature = "with-containers")]
use crate::mock::ssh as ssh_mock;

#[cfg(feature = "with-containers")]
use ssh2_config::ParseRule;

#[test]
fn should_init_scp_fs() {
let mut client = ScpFs::new(SshOpts::new("localhost"));
Expand Down Expand Up @@ -1446,7 +1449,7 @@ mod test {
let mut client = ScpFs::new(
SshOpts::new("scp")
.key_storage(Box::new(ssh_mock::MockSshKeyStorage::default()))
.config_file(config_file.path()),
.config_file(config_file.path(), ParseRule::ALLOW_UNKNOWN_FIELDS),
);
assert!(client.connect().is_ok());
// Create wrkdir
Expand Down
5 changes: 4 additions & 1 deletion src/ssh/sftp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,9 @@ mod test {
#[cfg(feature = "with-containers")]
use crate::mock::ssh as ssh_mock;

#[cfg(feature = "with-containers")]
use ssh2_config::ParseRule;

#[test]
fn should_initialize_sftp_filesystem() {
let mut client = SftpFs::new(SshOpts::new("127.0.0.1"));
Expand Down Expand Up @@ -1263,7 +1266,7 @@ mod test {
let mut client = SftpFs::new(
SshOpts::new("sftp")
.key_storage(Box::new(ssh_mock::MockSshKeyStorage::default()))
.config_file(config_file.path()),
.config_file(config_file.path(), ParseRule::ALLOW_UNKNOWN_FIELDS),
);
assert!(client.connect().is_ok());
// Create wrkdir
Expand Down

0 comments on commit 2cabc17

Please sign in to comment.