Commit 707f1b44 authored by Christian Kandeler's avatar Christian Kandeler Committed by Fawzi Mohamed
Browse files

SSH: Adapt tests to API change.



Change-Id: I0b104942d97238aff8ac21e0e047a17079a53181
Reviewed-by: default avatarFawzi Mohamed <fawzi.mohamed@digia.com>
parent 0d368345
......@@ -45,6 +45,7 @@ ArgumentsCollector::ArgumentsCollector(const QStringList &args)
QSsh::SshConnectionParameters ArgumentsCollector::collect(bool &success) const
{
SshConnectionParameters parameters;
parameters.options &= ~SshIgnoreDefaultProxy;
try {
bool authTypeGiven = false;
bool portGiven = false;
......@@ -76,13 +77,13 @@ QSsh::SshConnectionParameters ArgumentsCollector::collect(bool &success) const
authTypeGiven = true;
continue;
}
if (!checkForNoProxy(pos, parameters.proxyType, proxySettingGiven))
if (!checkForNoProxy(pos, parameters.options, proxySettingGiven))
throw ArgumentErrorException(QLatin1String("unknown option ") + m_arguments.at(pos));
}
Q_ASSERT(pos <= m_arguments.count());
if (pos == m_arguments.count() - 1) {
if (!checkForNoProxy(pos, parameters.proxyType, proxySettingGiven))
if (!checkForNoProxy(pos, parameters.options, proxySettingGiven))
throw ArgumentErrorException(QLatin1String("unknown option ") + m_arguments.at(pos));
}
......@@ -156,13 +157,13 @@ bool ArgumentsCollector::checkAndSetIntArg(int &pos, int &val,
return false;
}
bool ArgumentsCollector::checkForNoProxy(int &pos,
SshConnectionParameters::ProxyType &type, bool &alreadyGiven) const
bool ArgumentsCollector::checkForNoProxy(int &pos, SshConnectionOptions &options,
bool &alreadyGiven) const
{
if (m_arguments.at(pos) == QLatin1String("-no-proxy")) {
if (alreadyGiven)
throw ArgumentErrorException(QLatin1String("proxy setting given twice."));
type = SshConnectionParameters::NoProxy;
options |= SshIgnoreDefaultProxy;
alreadyGiven = true;
return true;
}
......
......@@ -50,9 +50,7 @@ private:
bool checkAndSetStringArg(int &pos, QString &arg, const char *opt) const;
bool checkAndSetIntArg(int &pos, int &val, bool &alreadyGiven,
const char *opt) const;
bool checkForNoProxy(int &pos,
QSsh::SshConnectionParameters::ProxyType &type,
bool &alreadyGiven) const;
bool checkForNoProxy(int &pos, QSsh::SshConnectionOptions &options, bool &alreadyGiven) const;
const QStringList m_arguments;
};
......
......@@ -43,6 +43,7 @@ ArgumentsCollector::ArgumentsCollector(const QStringList &args)
Parameters ArgumentsCollector::collect(bool &success) const
{
Parameters parameters;
parameters.sshParams.options &= ~SshIgnoreDefaultProxy;
try {
bool authTypeGiven = false;
bool portGiven = false;
......@@ -77,13 +78,13 @@ Parameters ArgumentsCollector::collect(bool &success) const
authTypeGiven = true;
continue;
}
if (!checkForNoProxy(pos, parameters.sshParams.proxyType, proxySettingGiven))
if (!checkForNoProxy(pos, parameters.sshParams.options, proxySettingGiven))
throw ArgumentErrorException(QLatin1String("unknown option ") + m_arguments.at(pos));
}
Q_ASSERT(pos <= m_arguments.count());
if (pos == m_arguments.count() - 1) {
if (!checkForNoProxy(pos, parameters.sshParams.proxyType, proxySettingGiven))
if (!checkForNoProxy(pos, parameters.sshParams.options, proxySettingGiven))
throw ArgumentErrorException(QLatin1String("unknown option ") + m_arguments.at(pos));
}
......@@ -154,13 +155,13 @@ bool ArgumentsCollector::checkAndSetIntArg(int &pos, int &val,
return false;
}
bool ArgumentsCollector::checkForNoProxy(int &pos,
SshConnectionParameters::ProxyType &type, bool &alreadyGiven) const
bool ArgumentsCollector::checkForNoProxy(int &pos, SshConnectionOptions &options,
bool &alreadyGiven) const
{
if (m_arguments.at(pos) == QLatin1String("-no-proxy")) {
if (alreadyGiven)
throw ArgumentErrorException(QLatin1String("proxy setting given twice."));
type = SshConnectionParameters::NoProxy;
options |= SshIgnoreDefaultProxy;
alreadyGiven = true;
return true;
}
......
......@@ -50,7 +50,7 @@ private:
bool checkAndSetStringArg(int &pos, QString &arg, const char *opt) const;
bool checkAndSetIntArg(int &pos, int &val, bool &alreadyGiven,
const char *opt) const;
bool checkForNoProxy(int &pos, QSsh::SshConnectionParameters::ProxyType &type,
bool checkForNoProxy(int &pos, QSsh::SshConnectionOptions &options,
bool &alreadyGiven) const;
const QStringList m_arguments;
......
......@@ -48,6 +48,7 @@ ArgumentsCollector::ArgumentsCollector(const QStringList &args)
QSsh::SshConnectionParameters ArgumentsCollector::collect(bool &success) const
{
SshConnectionParameters parameters;
parameters.options &= ~SshIgnoreDefaultProxy;
parameters.host = QLatin1String("localhost");
try {
......@@ -80,13 +81,13 @@ QSsh::SshConnectionParameters ArgumentsCollector::collect(bool &success) const
authTypeGiven = true;
continue;
}
if (!checkForNoProxy(pos, parameters.proxyType, proxySettingGiven))
if (!checkForNoProxy(pos, parameters.options, proxySettingGiven))
throw ArgumentErrorException(QLatin1String("unknown option ") + m_arguments.at(pos));
}
Q_ASSERT(pos <= m_arguments.count());
if (pos == m_arguments.count() - 1) {
if (!checkForNoProxy(pos, parameters.proxyType, proxySettingGiven))
if (!checkForNoProxy(pos, parameters.options, proxySettingGiven))
throw ArgumentErrorException(QLatin1String("unknown option ") + m_arguments.at(pos));
}
......@@ -160,13 +161,13 @@ bool ArgumentsCollector::checkAndSetIntArg(int &pos, int &val,
return false;
}
bool ArgumentsCollector::checkForNoProxy(int &pos,
SshConnectionParameters::ProxyType &type, bool &alreadyGiven) const
bool ArgumentsCollector::checkForNoProxy(int &pos, SshConnectionOptions &options,
bool &alreadyGiven) const
{
if (m_arguments.at(pos) == QLatin1String("-no-proxy")) {
if (alreadyGiven)
throw ArgumentErrorException(QLatin1String("proxy setting given twice."));
type = SshConnectionParameters::NoProxy;
options |= SshIgnoreDefaultProxy;
alreadyGiven = true;
return true;
}
......
......@@ -53,9 +53,7 @@ private:
bool checkAndSetStringArg(int &pos, QString &arg, const char *opt) const;
bool checkAndSetIntArg(int &pos, int &val, bool &alreadyGiven,
const char *opt) const;
bool checkForNoProxy(int &pos,
QSsh::SshConnectionParameters::ProxyType &type,
bool &alreadyGiven) const;
bool checkForNoProxy(int &pos, QSsh::SshConnectionOptions &options, bool &alreadyGiven) const;
const QStringList m_arguments;
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment