File indexing completed on 2024-04-28 09:46:02
0001 #include "kgpgaddphoto.h" 0002 #include "../transactions/kgpgaddphoto.h" 0003 #include "../kgpginterface.h" 0004 #include "common.h" 0005 0006 #include <QSignalSpy> 0007 #include <QTest> 0008 0009 void KGpgAddPhotoTest::init() 0010 { 0011 QVERIFY(resetGpgConf(m_tempdir)); 0012 } 0013 0014 void KGpgAddPhotoTest::testAddPhoto() 0015 { 0016 const QString passphrase = readFile(QLatin1String("keys/kgpgtest_BA7695F3C550DF14.pass")); 0017 addGpgKey(m_tempdir, QLatin1String("keys/kgpgtest_BA7695F3C550DF14_pub.asc")); 0018 addGpgKey(m_tempdir, QLatin1String("keys/kgpgtest_BA7695F3C550DF14.asc"), passphrase); 0019 QString keyID = QLatin1String("BA7695F3C550DF14"); 0020 QString imagepath = QLatin1String("keys/image_small.jpg"); 0021 KGpgAddPhoto *transaction = new KGpgAddPhoto(this, keyID, imagepath); 0022 addPasswordArguments(transaction, passphrase); 0023 QSignalSpy spy(transaction, &KGpgAddPhoto::done); 0024 transaction->start(); 0025 QVERIFY(spy.wait(10000)); 0026 QVERIFY(hasPhoto(m_tempdir, keyID)); 0027 } 0028 0029 QTEST_GUILESS_MAIN(KGpgAddPhotoTest)