add a test for an invalid signature
This commit is contained in:
parent
8e9a38659e
commit
aeadba3adf
BIN
tests/signed.plasmoid.invalid.sig
Normal file
BIN
tests/signed.plasmoid.invalid.sig
Normal file
Binary file not shown.
@ -23,15 +23,18 @@
|
||||
|
||||
#include <kdebug.h>
|
||||
|
||||
#include "plasma/applet.h"
|
||||
#include "plasma/remote/signing.h"
|
||||
|
||||
SigningTest::SigningTest(QObject *parent)
|
||||
: QObject(parent),
|
||||
m_signing(0)
|
||||
m_signing(0),
|
||||
m_package(QString::fromLatin1(KDESRCDIR) + "signedPackage", Plasma::Applet::packageStructure())
|
||||
{
|
||||
const QString prefix = QString::fromLatin1(KDESRCDIR);
|
||||
m_package = prefix + "signed.plasmoid";
|
||||
m_packageSig = prefix + "signed.plasmoid.asc";
|
||||
m_path = prefix + "signed.plasmoid";
|
||||
m_sig = prefix + "signed.plasmoid.asc";
|
||||
m_invalidSig = prefix + "signed.plasmoid.invalid.sig";
|
||||
}
|
||||
|
||||
void SigningTest::init()
|
||||
@ -53,18 +56,27 @@ void SigningTest::confirmCtorPerformance()
|
||||
void SigningTest::missingFiles()
|
||||
{
|
||||
QVERIFY(m_signing->signerOf(KUrl("/nonexistantpackage"), KUrl("/noneexistantsignature")).isEmpty());
|
||||
QVERIFY(m_signing->signerOf(KUrl(m_package), KUrl("/noneexistantsignature")).isEmpty());
|
||||
QVERIFY(m_signing->signerOf(KUrl("/nonexistantpackage"), KUrl(m_packageSig)).isEmpty());
|
||||
QVERIFY(m_signing->signerOf(KUrl(m_path), KUrl("/noneexistantsignature")).isEmpty());
|
||||
QVERIFY(m_signing->signerOf(KUrl("/nonexistantpackage"), KUrl(m_sig)).isEmpty());
|
||||
}
|
||||
|
||||
void SigningTest::invalidSignature()
|
||||
{
|
||||
QVERIFY(m_signing->signerOf(m_path, m_invalidSig).isEmpty());
|
||||
}
|
||||
|
||||
void SigningTest::validSignature()
|
||||
{
|
||||
QVERIFY(!m_signing->signerOf(m_package, m_packageSig).isEmpty());
|
||||
QVERIFY(!m_signing->signerOf(m_path, m_sig).isEmpty());
|
||||
}
|
||||
|
||||
void SigningTest::validSignatureWithoutDefinedSigFile()
|
||||
{
|
||||
QVERIFY(!m_signing->signerOf(m_package).isEmpty());
|
||||
QVERIFY(!m_signing->signerOf(m_path).isEmpty());
|
||||
}
|
||||
|
||||
void SigningTest::validPackage()
|
||||
{
|
||||
}
|
||||
|
||||
void SigningTest::confirmDtorPerformance()
|
||||
|
@ -21,11 +21,14 @@
|
||||
|
||||
#include <qtest_kde.h>
|
||||
|
||||
#include "plasma/package.h"
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
class Signing;
|
||||
}
|
||||
|
||||
|
||||
class SigningTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -39,14 +42,18 @@ public Q_SLOTS:
|
||||
private Q_SLOTS:
|
||||
void confirmCtorPerformance();
|
||||
void missingFiles();
|
||||
void invalidSignature();
|
||||
void validSignature();
|
||||
void validSignatureWithoutDefinedSigFile();
|
||||
void validPackage();
|
||||
void confirmDtorPerformance();
|
||||
|
||||
private:
|
||||
Plasma::Signing *m_signing;
|
||||
QString m_package;
|
||||
QString m_packageSig;
|
||||
Plasma::Package m_package;
|
||||
QString m_path;
|
||||
QString m_sig;
|
||||
QString m_invalidSig;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user