MCPcopy Create free account
hub / github.com/IJHack/QtPass / getRecipientStringCount

Method getRecipientStringCount

tests/auto/util/tst_util.cpp:1199–1230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1197}
1198
1199void tst_util::getRecipientStringCount() {
1200 QTemporaryDir tempDir;
1201 QString passStore = tempDir.path();
1202 QString gpgIdFile = passStore + "/.gpg-id";
1203
1204 QFile file(gpgIdFile);
1205 QVERIFY(file.open(QIODevice::WriteOnly));
1206 file.write("ABCDEF12\n34567890\n");
1207 file.close();
1208
1209 const QString originalPassStore = QtPassSettings::getPassStore();
1210 PassStoreGuard originalGuard(originalPassStore);
1211 QtPassSettings::setPassStore(passStore);
1212 int count = 0;
1213 QStringList parsedRecipients =
1214 Pass::getRecipientString(passStore, " ", &count);
1215 QStringList recipientsNoCount = Pass::getRecipientString(passStore, " ");
1216
1217 QStringList expectedRecipients = {"ABCDEF12", "34567890"};
1218 // Verify count matches the expected number of parsed recipients.
1219 QVERIFY(count > 0);
1220 QCOMPARE(count, (int)expectedRecipients.size());
1221 // Verify both overloads return the same result
1222 QCOMPARE(parsedRecipients, recipientsNoCount);
1223 // Verify that the parsed recipients match the expected values.
1224 QVERIFY(parsedRecipients.contains("ABCDEF12"));
1225 QVERIFY(parsedRecipients.contains("34567890"));
1226 // Also verify that the recipients returned without count match the expected
1227 // values.
1228 QVERIFY(recipientsNoCount.contains("ABCDEF12"));
1229 QVERIFY(recipientsNoCount.contains("34567890"));
1230}
1231
1232void tst_util::getGpgIdPathBasic() {
1233 QTemporaryDir tempDir;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected