Automatically detect USB device changes

This commit is contained in:
Janek Bevendorff 2023-12-10 19:48:43 +01:00 committed by Jonathan White
parent 79ca00604a
commit 6a273363c4
41 changed files with 1503 additions and 823 deletions

View file

@ -2253,7 +2253,7 @@ void TestCli::testYubiKeyOption()
YubiKey::instance()->findValidKeys();
auto keys = YubiKey::instance()->foundKeys();
const auto keys = YubiKey::instance()->foundKeys().keys();
if (keys.isEmpty()) {
QSKIP("No YubiKey devices were detected.");
}

View file

@ -44,11 +44,12 @@ void TestYubiKeyChallengeResponse::testDetectDevices()
YubiKey::instance()->findValidKeys();
// Look at the information retrieved from the key(s)
for (auto key : YubiKey::instance()->foundKeys()) {
auto displayName = YubiKey::instance()->getDisplayName(key);
const auto foundKeys = YubiKey::instance()->foundKeys();
for (auto i = foundKeys.cbegin(); i != foundKeys.cend(); ++i) {
const auto& displayName = i.value();
QVERIFY(displayName.contains("Challenge-Response - Slot") || displayName.contains("Configured Slot -"));
QVERIFY(displayName.contains(QString::number(key.first)));
QVERIFY(displayName.contains(QString::number(key.second)));
QVERIFY(displayName.contains(QString::number(i.key().first)));
QVERIFY(displayName.contains(QString::number(i.key().second)));
}
}
@ -59,7 +60,7 @@ void TestYubiKeyChallengeResponse::testDetectDevices()
*/
void TestYubiKeyChallengeResponse::testKeyChallenge()
{
auto keys = YubiKey::instance()->foundKeys();
auto keys = YubiKey::instance()->foundKeys().keys();
if (keys.isEmpty()) {
QSKIP("No YubiKey devices were detected.");
}

View file

@ -141,6 +141,7 @@ void TestGui::init()
databaseOpenWidget->findChild<PasswordWidget*>("editPassword")->findChild<QLineEdit*>("passwordEdit");
QVERIFY(editPassword);
editPassword->setFocus();
QTRY_VERIFY(editPassword->hasFocus());
QTest::keyClicks(editPassword, "a");
QTest::keyClick(editPassword, Qt::Key_Enter);