mirror of
https://gitlab.com/spaceti-app/integrations/acs/colnod-connector.git
synced 2026-07-12 13:00:41 +02:00
fix for Qt 5.9
This commit is contained in:
parent
da391a44d5
commit
c44def7650
@ -78,11 +78,12 @@ void RequestManager::getRequest(QString endpoint)
|
||||
qDebug() << reply->attribute(QNetworkRequest::HttpStatusCodeAttribute);
|
||||
|
||||
jsonResponse = reply->readAll();
|
||||
//qDebug() << jsonResponse;
|
||||
emit responseReady();
|
||||
});
|
||||
}
|
||||
|
||||
QString RequestManager::getFromJson(QString json, QString member)
|
||||
QString RequestManager::getFromJson(QString json, const QString &member)
|
||||
{
|
||||
QJsonParseError err;
|
||||
QJsonDocument document = QJsonDocument::fromJson(json.toUtf8(),&err);
|
||||
@ -90,7 +91,7 @@ QString RequestManager::getFromJson(QString json, QString member)
|
||||
{
|
||||
qDebug() << err.errorString();
|
||||
}
|
||||
return document[member].toString();
|
||||
return document.object().value(member).toString();
|
||||
}
|
||||
|
||||
QString RequestManager::encryptedPassword(QString password)
|
||||
|
||||
@ -34,7 +34,7 @@ public:
|
||||
QString getToken(){return token;}
|
||||
private:
|
||||
|
||||
QString getFromJson(QString json, QString member);
|
||||
QString getFromJson(QString json, const QString &member);
|
||||
QString encryptedPassword(QString password);
|
||||
QString getLoginHeader(QString username, QString hash);
|
||||
void prepareAuthHeader();
|
||||
|
||||
@ -12,7 +12,7 @@ void UnitTest::loginSuccessfully()
|
||||
QString json = testAccess->getResponse();
|
||||
qDebug() << json;
|
||||
QJsonDocument doc = QJsonDocument::fromJson(json.toUtf8());
|
||||
QVERIFY2(doc["id"].isString(), "No parameter 'id' in response");
|
||||
QVERIFY2(doc.object().value("id").isString(), "No parameter 'id' in response");
|
||||
}
|
||||
|
||||
//POST request w/o datas
|
||||
@ -28,9 +28,9 @@ void UnitTest::getSubjects()
|
||||
QString json = testAccess->getResponse();
|
||||
QJsonDocument doc = QJsonDocument::fromJson(json.toUtf8());
|
||||
QVERIFY(doc.isObject());
|
||||
QVERIFY2(doc["items"].isArray(), "No parameter 'id' in response");
|
||||
qDebug() << doc["items"].toArray()[0].toObject()["id"].toString();
|
||||
QVERIFY2(doc["items"].toArray()[0].toObject()["id"].isString(), "ada");
|
||||
QVERIFY2(doc.object().value("items").isArray(), "No parameter 'id' in response");
|
||||
qDebug() << doc.object().value("items").toArray()[0].toObject()["id"].toString();
|
||||
QVERIFY2(doc.object().value("items").toArray()[0].toObject()["id"].isString(), "ada");
|
||||
|
||||
}
|
||||
|
||||
@ -58,8 +58,8 @@ void UnitTest::getTokensOpenManager()
|
||||
QVERIFY(spy.isValid());
|
||||
QCOMPARE(spy.count(), 1);
|
||||
QString response = testAccess->getResponse();
|
||||
QVERIFY(!response.isEmpty());
|
||||
qDebug() << response;
|
||||
QVERIFY(!response.isEmpty());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -11,12 +11,10 @@ class UnitTest : public QObject
|
||||
|
||||
private slots:
|
||||
|
||||
void loginSuccessfully();
|
||||
|
||||
|
||||
void getTokens();
|
||||
void getTokensOpenManager();
|
||||
void getSubjects();
|
||||
void loginSuccessfully(); // /AaaManager/authSession
|
||||
void getSubjects(); // /SubjectManager/getSubjects
|
||||
void getTokens(); // /TokenManager/getTokens
|
||||
void getTokensOpenManager(); // /OpenManager/getTokenSubject
|
||||
|
||||
private:
|
||||
// QString host = "https://localhost:8080"; //colnod server (ssh -L 8080:192.168.254.11:8443 penta-master)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user