File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,28 @@ def test_ssh_client_sftp(self):
8585 os .rmdir (dirpath )
8686 del client
8787
88+ def test_ssh_client_directory (self ):
89+ """Tests copying directories with SSH client. Copy all the files from
90+ local directory to server, then make sure they are all present."""
91+ test_file_data = 'test'
92+ local_test_path = 'directory_test'
93+ remote_test_path = 'directory_test_copied'
94+ os .mkdir (local_test_path )
95+ remote_file_paths = []
96+ for i in range (0 , 10 ):
97+ local_file_path = os .path .join (local_test_path , 'foo' + str (i ))
98+ remote_file_path = os .path .join (remote_test_path , 'foo' + str (i ))
99+ remote_file_paths .append (remote_file_path )
100+ test_file = open (local_file_path , 'w' )
101+ test_file .write (test_file_data )
102+ test_file .close ()
103+ client = SSHClient (self .host , port = self .listen_port ,
104+ pkey = self .user_key )
105+ client .copy_file (local_test_path , remote_test_path )
106+ for path in remote_file_paths :
107+ self .assertTrue (os .path .isfile (path ))
108+
109+
88110 def test_ssh_agent_authentication (self ):
89111 """Test authentication via SSH agent.
90112 Do not provide public key to use when creating SSHClient,
You can’t perform that action at this time.
0 commit comments