simplify and add hint

This commit is contained in:
Adam Velebil 2023-11-14 14:03:47 +01:00
parent 40f806ed17
commit 4ae9791841
No known key found for this signature in database
GPG Key ID: C9B1E4A3CBBD2E10

View File

@ -127,17 +127,15 @@ extension AppWidgetTester on WidgetTester {
await collectYubiKeyInformation();
if (yubiKeySerialNumber == null) {
fail('No YubiKey connected');
}
if (!approvedSerialNumbers.contains(yubiKeySerialNumber)) {
if (yubiKeySerialNumber == null) {
expect(
approvedSerialNumbers.contains(yubiKeySerialNumber), equals(true),
reason: 'No YubiKey connected');
} else {
expect(
approvedSerialNumbers.contains(yubiKeySerialNumber), equals(true),
reason:
'YubiKey with S/N $yubiKeySerialNumber is not approved for integration tests.');
}
fail('YubiKey with S/N $yubiKeySerialNumber is not approved for '
'integration tests.\nUse --dart-define='
'YA_TEST_APPROVED_KEY_SN=$yubiKeySerialNumber test '
'parameter to approve it.');
}
return result;
@ -186,9 +184,10 @@ extension AppWidgetTester on WidgetTester {
// close the opened menu
await closeDrawer();
testLog(false,
'Connected YubiKey: $yubiKeySerialNumber/$yubiKeyFirmware - $yubiKeyName');
if (yubiKeySerialNumber != null) {
testLog(false,
'Connected YubiKey: $yubiKeySerialNumber/$yubiKeyFirmware - $yubiKeyName');
}
collectedYubiKeyInformation = true;
}
}