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 @@ -141,6 +141,28 @@ def test_ssh_client_sftp(self):
141141 os .rmdir (dirpath )
142142 del client
143143
144+ def test_ssh_client_directory (self ):
145+ """Tests copying directories with SSH client. Copy all the files from
146+ local directory to server, then make sure they are all present."""
147+ test_file_data = 'test'
148+ local_test_path = 'directory_test'
149+ remote_test_path = 'directory_test_copied'
150+ os .mkdir (local_test_path )
151+ remote_file_paths = []
152+ for i in range (0 , 10 ):
153+ local_file_path = os .path .join (local_test_path , 'foo' + str (i ))
154+ remote_file_path = os .path .join (remote_test_path , 'foo' + str (i ))
155+ remote_file_paths .append (remote_file_path )
156+ test_file = open (local_file_path , 'w' )
157+ test_file .write (test_file_data )
158+ test_file .close ()
159+ client = SSHClient (self .host , port = self .listen_port ,
160+ pkey = self .user_key )
161+ client .copy_file (local_test_path , remote_test_path )
162+ for path in remote_file_paths :
163+ self .assertTrue (os .path .isfile (path ))
164+
165+
144166 def test_ssh_agent_authentication (self ):
145167 """Test authentication via SSH agent.
146168 Do not provide public key to use when creating SSHClient,
You can’t perform that action at this time.
0 commit comments