34 lines
937 B
C++
34 lines
937 B
C++
#include "eetv4client.h"
|
|
|
|
#include <QtTest>
|
|
|
|
class EetV4ClientTest : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
private slots:
|
|
void rejectsNonHttpsEndpoint();
|
|
void rejectsNonPositiveTimeout();
|
|
};
|
|
|
|
void EetV4ClientTest::rejectsNonHttpsEndpoint()
|
|
{
|
|
EetV4Client client({QUrl(QStringLiteral("http://localhost/eet")), 1000});
|
|
EetV4Response response;
|
|
QString error;
|
|
QVERIFY(!client.sendSale({}, QStringLiteral("missing.p12"), {}, &response, &error));
|
|
QCOMPARE(error, QStringLiteral("EET endpoint must be a valid HTTPS URL."));
|
|
}
|
|
|
|
void EetV4ClientTest::rejectsNonPositiveTimeout()
|
|
{
|
|
EetV4Client client({QUrl(QStringLiteral("https://localhost/eet")), 0});
|
|
EetV4Response response;
|
|
QString error;
|
|
QVERIFY(!client.sendSale({}, QStringLiteral("missing.p12"), {}, &response, &error));
|
|
QCOMPARE(error, QStringLiteral("EET timeout must be positive."));
|
|
}
|
|
|
|
QTEST_MAIN(EetV4ClientTest)
|
|
#include "eetv4client_test.moc"
|