mirror of
https://gitlab.com/spaceti-app/integrations/acs/colnod-connector.git
synced 2026-07-12 15:40:40 +02:00
Add tests for colnod Api
This commit is contained in:
parent
6d148994ee
commit
f5ea0ed1a0
@ -2,3 +2,4 @@ TEMPLATE = subdirs
|
|||||||
|
|
||||||
SUBDIRS += \
|
SUBDIRS += \
|
||||||
database/tst_databaseapi.pro \
|
database/tst_databaseapi.pro \
|
||||||
|
colnod/tst_colnodapi.pro \
|
||||||
|
|||||||
42
test/auto/colnod/tst_colnodapi.cpp
Normal file
42
test/auto/colnod/tst_colnodapi.cpp
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#include <QtTest>
|
||||||
|
|
||||||
|
#include "colnodapi.h"
|
||||||
|
// add necessary includes here
|
||||||
|
|
||||||
|
class ColnodTest : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
friend class ColnodAPI;
|
||||||
|
private slots:
|
||||||
|
void login();
|
||||||
|
void getTokens();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void ColnodTest::login()
|
||||||
|
{
|
||||||
|
serversdk::RequestManager reqMan;
|
||||||
|
ColnodAPI colnod(&reqMan);
|
||||||
|
auto login = colnod.requestLogin();
|
||||||
|
QSignalSpy spy(login.get(), &serversdk::Request::finished);
|
||||||
|
QCOMPARE(spy.count(), 0);
|
||||||
|
QVERIFY(spy.wait());
|
||||||
|
QCOMPARE(spy.count(), 1);
|
||||||
|
QVERIFY(login->responseData().contains("id"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ColnodTest::getTokens()
|
||||||
|
{
|
||||||
|
serversdk::RequestManager reqMan;
|
||||||
|
ColnodAPI colnod(&reqMan);
|
||||||
|
auto login = colnod.requestLogin();
|
||||||
|
QSignalSpy spy(login.get(), &serversdk::Request::finished);
|
||||||
|
spy.wait();
|
||||||
|
qDebug().noquote() << login->responseData().mid(7,36);
|
||||||
|
}
|
||||||
|
|
||||||
|
QTEST_GUILESS_MAIN(ColnodTest)
|
||||||
|
|
||||||
|
#include "tst_colnodapi.moc"
|
||||||
11
test/auto/colnod/tst_colnodapi.pro
Normal file
11
test/auto/colnod/tst_colnodapi.pro
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
QT += testlib
|
||||||
|
QT -= gui
|
||||||
|
|
||||||
|
CONFIG += qt console warn_on depend_includepath testcase
|
||||||
|
CONFIG -= app_bundle
|
||||||
|
|
||||||
|
TEMPLATE = app
|
||||||
|
|
||||||
|
SOURCES += tst_colnodapi.cpp
|
||||||
|
|
||||||
|
include(../../test.pri)
|
||||||
Loading…
x
Reference in New Issue
Block a user