diff options
author | Andre Heinecke <[email protected]> | 2016-04-03 09:48:46 +0000 |
---|---|---|
committer | Andre Heinecke <[email protected]> | 2016-04-03 09:48:46 +0000 |
commit | faf987dd62893955251378a2a715edd2892a540c (patch) | |
tree | 5072f5a79493fa048a1c19312ab943859c5c0e7c /lang/qt/tests/t-keylist.cpp | |
parent | Qt: Add missing MOC includes (diff) | |
download | gpgme-faf987dd62893955251378a2a715edd2892a540c.tar.gz gpgme-faf987dd62893955251378a2a715edd2892a540c.zip |
Qt: Add a unit test for qgpgme
* configure.ac: Configure test Makefile.
* m4/qt.m4: Look up Qt5Test flags.
* lang/qt/tests/t-keylist.cpp: New. Simple keylist check.
* lang/qt/tests/Makefile.am: New. General test framework.
--
This test mostly checks that it basically compiles / works and
adds a test framework.
Diffstat (limited to 'lang/qt/tests/t-keylist.cpp')
-rw-r--r-- | lang/qt/tests/t-keylist.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lang/qt/tests/t-keylist.cpp b/lang/qt/tests/t-keylist.cpp new file mode 100644 index 00000000..67ace7f5 --- /dev/null +++ b/lang/qt/tests/t-keylist.cpp @@ -0,0 +1,31 @@ +#include <QDebug> +#include <QTest> +#include "keylistjob.h" +#include "qgpgmebackend.h" +#include "keylistresult.h" + +using namespace QGpgME; + +class KeyListTest : public QObject +{ + Q_OBJECT + +private Q_SLOTS: + + void testSingleKeyListSync() + { + QGpgMEBackend backend; + KeyListJob *job = backend.openpgp()->keyListJob(false, false, false); + std::vector<GpgME::Key> keys; + GpgME::KeyListResult result = job->exec(QStringList() << QStringLiteral("[email protected]"), + false, keys); + Q_ASSERT (!result.error()); + Q_ASSERT (keys.size() == 1); + const QString kId = QLatin1String(keys.front().keyID()); + Q_ASSERT (kId == QStringLiteral("2D727CC768697734")); + } +}; + +QTEST_MAIN(KeyListTest) + +#include "t-keylist.moc" |