67ace7f5b7add82f0e3a855ceee636d361c98aed
[gpgme.git] / lang / qt / tests / t-keylist.cpp
1 #include <QDebug>
2 #include <QTest>
3 #include "keylistjob.h"
4 #include "qgpgmebackend.h"
5 #include "keylistresult.h"
6
7 using namespace QGpgME;
8
9 class KeyListTest : public QObject
10 {
11     Q_OBJECT
12
13 private Q_SLOTS:
14
15     void testSingleKeyListSync()
16     {
17         QGpgMEBackend backend;
18         KeyListJob *job = backend.openpgp()->keyListJob(false, false, false);
19         std::vector<GpgME::Key> keys;
20         GpgME::KeyListResult result = job->exec(QStringList() << QStringLiteral("alfa@example.net"),
21                                                 false, keys);
22         Q_ASSERT (!result.error());
23         Q_ASSERT (keys.size() == 1);
24         const QString kId = QLatin1String(keys.front().keyID());
25         Q_ASSERT (kId == QStringLiteral("2D727CC768697734"));
26     }
27 };
28
29 QTEST_MAIN(KeyListTest)
30
31 #include "t-keylist.moc"