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

59 lines
1.6 KiB
C++
Raw Normal View History

2017-07-03 09:30:10 +02:00
/*!
* \brief Unit tests for \ref PaosMessage
*
2019-05-22 10:08:38 +02:00
* \copyright Copyright (c) 2015-2019 Governikus GmbH & Co. KG, Germany
2017-07-03 09:30:10 +02:00
*/
#include "paos/PaosMessage.h"
#include <QtCore>
#include <QtTest>
using namespace governikus;
class test_PaosMessage
: public QObject
{
Q_OBJECT
private Q_SLOTS:
void type()
{
PaosMessage msg(PaosType::UNKNOWN);
QCOMPARE(msg.mType, PaosType::UNKNOWN);
PaosMessage msg2(PaosType::DID_AUTHENTICATE_EAC_ADDITIONAL_INPUT_TYPE);
QCOMPARE(msg2.mType, PaosType::DID_AUTHENTICATE_EAC_ADDITIONAL_INPUT_TYPE);
}
void emptyMembers()
{
PaosMessage msg(PaosType::UNKNOWN);
QCOMPARE(msg.getMessageId(), QString());
QCOMPARE(msg.getRelatesTo(), QString());
}
void handleWSAddressingHeaders()
{
PaosMessage msg(PaosType::UNKNOWN);
2019-01-03 15:06:22 +01:00
QCOMPARE(msg.handleWSAddressingHeaders(QStringLiteral("elem name"), QStringLiteral("some value"), QXmlStreamAttributes()), false);
2017-07-03 09:30:10 +02:00
QCOMPARE(msg.getMessageId(), QString());
QCOMPARE(msg.getRelatesTo(), QString());
2019-01-03 15:06:22 +01:00
QCOMPARE(msg.handleWSAddressingHeaders(QStringLiteral("MessageID"), QStringLiteral("msg value"), QXmlStreamAttributes()), true);
QCOMPARE(msg.getMessageId(), QStringLiteral("msg value"));
2017-07-03 09:30:10 +02:00
QCOMPARE(msg.getRelatesTo(), QString());
2019-01-03 15:06:22 +01:00
QCOMPARE(msg.handleWSAddressingHeaders(QStringLiteral("RelatesTo"), QStringLiteral("relates value"), QXmlStreamAttributes()), true);
QCOMPARE(msg.getMessageId(), QStringLiteral("msg value"));
QCOMPARE(msg.getRelatesTo(), QStringLiteral("relates value"));
2017-07-03 09:30:10 +02:00
}
};
QTEST_GUILESS_MAIN(test_PaosMessage)
#include "test_PaosMessage.moc"