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)
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)