Ejemplo n.º 1
0
 def test_remote_listing_exists(self, mock_method):
     process = Mock()
     process.communicate = Mock(return_value=(b'stdout', b'No error'))
     mock_method.return_value = process
     path = Mock()
     path.as_posix = Mock(return_value='/')
     ssh = Ssh()
     result = ssh.remote_exists('remotehost', path)
     self.assertTrue(result)
Ejemplo n.º 2
0
 def test_remote_listing_does_not_exist(self, mock_method):
     process = Mock()
     process.communicate = Mock(return_value=(b'stdout',
                                              b'No such file or directory'))
     mock_method.return_value = process
     path = Mock()
     path.as_posix = Mock(return_value='/')
     ssh = Ssh()
     result = ssh.remote_exists('remotehost', path)
     self.assertFalse(result)