File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -828,6 +828,8 @@ async fn local_socket_forward() {
828
828
async fn test_sftp_subsystem ( ) {
829
829
use openssh_sftp_client:: highlevel:: Sftp ;
830
830
831
+ let content = b"Helop, world!\n " ;
832
+
831
833
for session in connects ( ) . await {
832
834
let mut child = session
833
835
. subsystem ( "sftp" )
@@ -837,15 +839,23 @@ async fn test_sftp_subsystem() {
837
839
. await
838
840
. unwrap ( ) ;
839
841
840
- Sftp :: new (
842
+ let sftp = Sftp :: new (
841
843
child. stdin ( ) . take ( ) . unwrap ( ) ,
842
844
child. stdout ( ) . take ( ) . unwrap ( ) ,
843
845
Default :: default ( ) ,
844
846
)
845
847
. await
846
- . unwrap ( )
847
- . close ( )
848
- . await
849
848
. unwrap ( ) ;
849
+
850
+ let file_path = "/tmp/file" ;
851
+
852
+ {
853
+ let mut fs = sftp. fs ( ) ;
854
+
855
+ fs. write ( file_path, content) . await . unwrap ( ) ;
856
+ assert_eq ! ( & * sftp. fs( ) . read( file_path) . await . unwrap( ) , content) ;
857
+ }
858
+
859
+ sftp. close ( ) . await . unwrap ( ) ;
850
860
}
851
861
}
You can’t perform that action at this time.
0 commit comments