rust_integration_services/sftp/
mod.rs

1#[cfg(feature = "sftp")]
2mod sftp_auth;
3#[cfg(feature = "sftp")]
4pub mod sftp_receiver_event;
5#[cfg(feature = "sftp")]
6pub mod sftp_receiver;
7#[cfg(feature = "sftp")]
8pub mod sftp_sender;
9
10#[cfg(feature = "sftp")]
11#[cfg(test)]
12mod test {
13    use crate::sftp::{sftp_receiver::SftpReceiver, sftp_sender::SftpSender};
14    
15    #[tokio::test(start_paused = true)]
16    async fn sftp_receiver() {
17        let result = SftpReceiver::new("127.0.0.1:2222", "user").password("pass").remote_path("upload").receive_once("./test/file/out").await;
18        assert!(result.is_ok());
19    }
20
21    #[tokio::test(start_paused = true)]
22    async fn sftp_sender_file() {
23        let result = SftpSender::new("127.0.0.1:2222", "user").password("pass").remote_path("upload").send_file("./test/file/in/TextFile1.txt").await;
24        assert!(result.is_ok());
25    }
26
27    #[tokio::test(start_paused = true)]
28    async fn sftp_sender_bytes() {
29        let result = SftpSender::new("127.0.0.1:2222", "user").password("pass").remote_path("upload").file_name("file.txt").send_string("test").await;
30        assert!(result.is_ok());
31    }
32
33}