def _test_mount_share(self, mock_execute, already_mounted=False): if already_mounted: err_msg = 'Device or resource busy' mock_execute.side_effect = [ None, processutils.ProcessExecutionError(err_msg)] remotefs.mount_share( mock.sentinel.mount_path, mock.sentinel.export_path, mock.sentinel.export_type, options=[mock.sentinel.mount_options]) mock_execute.assert_any_call('mkdir', '-p', mock.sentinel.mount_path) mock_execute.assert_any_call('mount', '-t', mock.sentinel.export_type, mock.sentinel.mount_options, mock.sentinel.export_path, mock.sentinel.mount_path, run_as_root=True)