Files
keepassxc/tests/mock/MockRemoteProcess.h
T
50e2a47df3 Remote sync: show script error output in the failure message (#13779)
- Append the script's stderr (fallback stdout, capped at 500 chars) to
  download/upload error messages so the actual failure reason is visible
  (e.g. 'NAS share not connected: /Volumes/...').
- Sync error messages now stay visible until closed instead of
  auto-hiding, so the detail can actually be read.
- Do not attempt an upload after a failed download (previously an upload
  with an empty temp path was attempted, masking the real download error).
- Tests: MockRemoteProcess gains configurable exit code/error output;
  new TestGui::testRemoteSyncErrorDetail.

---------

Co-authored-by: moritzthecat <[email protected]>
Co-authored-by: droidmonkey <[email protected]>
2026-11-30 06:31:42 -05:00

46 lines
1.5 KiB
C++

/*
* Copyright (C) 2023 KeePassXC Team <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 or (at your option)
* version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KEEPASSXC_MOCKREMOTEPROCESS_H
#define KEEPASSXC_MOCKREMOTEPROCESS_H
#include "gui/remote/RemoteProcess.h"
class MockRemoteProcess : public RemoteProcess
{
public:
explicit MockRemoteProcess(QObject* parent, QString dbPath, int exitCode = 0, QString errorOutput = {});
~MockRemoteProcess() override = default;
void start(const QString& program) override;
qint64 write(const QString& data) override;
bool waitForBytesWritten() override;
void closeWriteChannel() override;
bool waitForFinished(int msecs) override;
[[nodiscard]] int exitCode() const override;
virtual QString readOutput() override;
virtual QString readError() override;
private:
QByteArray m_data;
QString m_dbPath;
int m_exitCode = 0;
QString m_errorOutput;
};
#endif // KEEPASSXC_MOCKREMOTEPROCESS_H