AusweisApp2/test/qt/core/paos/test_paoshandler.cpp

100 lines
2.5 KiB
C++
Raw Normal View History

2017-07-03 09:30:10 +02:00
/*!
2019-05-22 10:08:38 +02:00
* \copyright Copyright (c) 2014-2019 Governikus GmbH & Co. KG, Germany
2017-07-03 09:30:10 +02:00
*/
#include <QByteArray>
#include <QFile>
#include <QtCore/QtCore>
#include <QtTest/QtTest>
#include "paos/PaosHandler.h"
2017-09-15 10:23:30 +02:00
#include "TestFileHelper.h"
2017-07-03 09:30:10 +02:00
using namespace governikus;
class test_paoshandler
: public QObject
{
Q_OBJECT
private Q_SLOTS:
void parseDIDAuthenticateEAC1()
{
QByteArray initFW = TestFileHelper::readFile(":/paos/DIDAuthenticateEAC1.xml");
PaosHandler handler(initFW);
QVERIFY(handler.getDetectedPaosType() == PaosType::DID_AUTHENTICATE_EAC1);
}
// test data of testbed (the attribute value of xsi:type contains a namespace identifier)
void parseDIDAuthenticateEAC1_fromTestbed()
{
QByteArray initFW = TestFileHelper::readFile(":/paos/DIDAuthenticateEAC1_2.xml");
PaosHandler handler(initFW);
QVERIFY(handler.getDetectedPaosType() == PaosType::DID_AUTHENTICATE_EAC1);
}
void parseDIDAuthenticateEAC2()
{
QByteArray initFW = TestFileHelper::readFile(":/paos/DIDAuthenticateEAC2.xml");
PaosHandler handler(initFW);
QVERIFY(handler.getDetectedPaosType() == PaosType::DID_AUTHENTICATE_EAC2);
}
void parseDIDAuthenticateEACAdditionalInputType()
{
QByteArray initFW = TestFileHelper::readFile(":/paos/DIDAuthenticateEACAdditionalInput.xml");
PaosHandler handler(initFW);
QVERIFY(handler.getDetectedPaosType() == PaosType::DID_AUTHENTICATE_EAC_ADDITIONAL_INPUT_TYPE);
}
void parseDIDList()
{
QByteArray initFW = TestFileHelper::readFile(":/paos/DIDList.xml");
PaosHandler handler(initFW);
QVERIFY(handler.getDetectedPaosType() == PaosType::DID_LIST);
}
void parseDisconnect()
{
QByteArray initFW = TestFileHelper::readFile(":/paos/Disconnect.xml");
PaosHandler handler(initFW);
QVERIFY(handler.getDetectedPaosType() == PaosType::DISCONNECT);
}
void parseInitializeFramework()
{
QByteArray initFW = TestFileHelper::readFile(":/paos/InitializeFramework.xml");
PaosHandler handler(initFW);
QVERIFY(handler.getDetectedPaosType() == PaosType::INITIALIZE_FRAMEWORK);
}
void parseStartPAOSResponse()
{
QByteArray initFW = TestFileHelper::readFile(":/paos/StartPAOSResponse1.xml");
PaosHandler handler(initFW);
QVERIFY(handler.getDetectedPaosType() == PaosType::STARTPAOS_RESPONSE);
}
void parseTransmit()
{
QByteArray initFW = TestFileHelper::readFile(":/paos/Transmit.xml");
PaosHandler handler(initFW);
QVERIFY(handler.getDetectedPaosType() == PaosType::TRANSMIT);
}
};
QTEST_GUILESS_MAIN(test_paoshandler)
#include "test_paoshandler.moc"