increase timeout on QSignalSpy

This commit is contained in:
Ondřej Fischer 2019-10-10 14:22:19 +02:00
parent c16ca8c0d7
commit c469149622
2 changed files with 14 additions and 7 deletions

View File

@ -6,7 +6,7 @@ void UnitTest::loginSuccessfully()
QJsonDocument config = testAccess->getConfig(); QJsonDocument config = testAccess->getConfig();
QSignalSpy spy(testAccess, SIGNAL(successLogin())); QSignalSpy spy(testAccess, SIGNAL(successLogin()));
testAccess->login(host, email, password); testAccess->login(host, email, password);
spy.wait(); spy.wait(10000);
QVERIFY(spy.isValid()); QVERIFY(spy.isValid());
QCOMPARE(spy.count(), 1); QCOMPARE(spy.count(), 1);
QString json = testAccess->getResponse(); QString json = testAccess->getResponse();
@ -22,7 +22,7 @@ void UnitTest::getSubjects()
RequestManager* testAccess = new RequestManager(); RequestManager* testAccess = new RequestManager();
QSignalSpy spy(testAccess, SIGNAL(responseReady())); QSignalSpy spy(testAccess, SIGNAL(responseReady()));
response = testAccess->getSubjects(); response = testAccess->getSubjects();
spy.wait(); spy.wait(10000);
QVERIFY(spy.isValid()); QVERIFY(spy.isValid());
QCOMPARE(spy.count(), 1); QCOMPARE(spy.count(), 1);
QString json = response->reply->readAll(); QString json = response->reply->readAll();
@ -41,7 +41,7 @@ void UnitTest::getTokens()
QSignalSpy spy(testAccess, SIGNAL(responseReady())); QSignalSpy spy(testAccess, SIGNAL(responseReady()));
response = testAccess->getTokens(); response = testAccess->getTokens();
QCOMPARE(spy.count(), 0); QCOMPARE(spy.count(), 0);
spy.wait(); spy.wait(10000);
QVERIFY(spy.isValid()); QVERIFY(spy.isValid());
QCOMPARE(spy.count(), 1); QCOMPARE(spy.count(), 1);
QString json = response->reply->readAll(); QString json = response->reply->readAll();
@ -59,7 +59,7 @@ void UnitTest::getTokenSubject()
QSignalSpy spy(testAccess, SIGNAL(responseReady())); QSignalSpy spy(testAccess, SIGNAL(responseReady()));
response = testAccess->getTokenSubject(); response = testAccess->getTokenSubject();
QCOMPARE(spy.count(), 0); QCOMPARE(spy.count(), 0);
spy.wait(); spy.wait(10000);
QVERIFY(spy.isValid()); QVERIFY(spy.isValid());
QCOMPARE(spy.count(), 1); QCOMPARE(spy.count(), 1);
QString json = response->reply->readAll(); QString json = response->reply->readAll();
@ -85,7 +85,7 @@ void UnitTest::subjectJSONParser()
RequestManager* testAccess = new RequestManager(); RequestManager* testAccess = new RequestManager();
QSignalSpy spy(testAccess, SIGNAL(responseReady())); QSignalSpy spy(testAccess, SIGNAL(responseReady()));
response = testAccess->getSubjects(); response = testAccess->getSubjects();
spy.wait(); spy.wait(10000);
QString json = response->reply->readAll(); QString json = response->reply->readAll();
QJsonDocument doc = QJsonDocument::fromJson(json.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(json.toUtf8());
QJsonArray arr = doc.object()["items"].toArray(); QJsonArray arr = doc.object()["items"].toArray();
@ -101,7 +101,7 @@ void UnitTest::tokenJSONParser()
RequestManager* testAccess = new RequestManager(); RequestManager* testAccess = new RequestManager();
QSignalSpy spy(testAccess, SIGNAL(responseReady())); QSignalSpy spy(testAccess, SIGNAL(responseReady()));
response = testAccess->getTokens(); response = testAccess->getTokens();
spy.wait(); spy.wait(10000);
QString json = response->reply->readAll(); QString json = response->reply->readAll();
QJsonDocument doc = QJsonDocument::fromJson(json.toUtf8()); QJsonDocument doc = QJsonDocument::fromJson(json.toUtf8());
QJsonArray arr = doc.object()["items"].toArray(); QJsonArray arr = doc.object()["items"].toArray();
@ -169,5 +169,11 @@ void UnitTest::saveDataToDB()
} }
void UnitTest::getUuid()
{
qDebug() << QUuid::createUuid().toString(QUuid::WithoutBraces);
QCOMPARE(1,1);
}
QTEST_MAIN(UnitTest) QTEST_MAIN(UnitTest)

View File

@ -26,6 +26,7 @@ private slots:
void connectToDB(); void connectToDB();
//void debugConnection(); //void debugConnection();
void saveDataToDB(); void saveDataToDB();
void getUuid();
private: private:
//QString host = "http://localhost:8080"; //colnod server (ssh -L 8080:192.168.254.11:8443 penta-master) //QString host = "http://localhost:8080"; //colnod server (ssh -L 8080:192.168.254.11:8443 penta-master)