mirror of
https://gitlab.com/spaceti-app/integrations/common/server-sdk.git
synced 2026-07-12 13:10:43 +02:00
fixing unittests ( using guiless app )
This commit is contained in:
parent
30925777b4
commit
174ede92ee
@ -140,6 +140,11 @@ QSqlQuery DatabaseUtils::insertIntoTable(const DatabaseTable *table, const QStri
|
||||
return res;
|
||||
}
|
||||
|
||||
void DatabaseUtils::udpateFromSqlQuery(DatabaseTable *table, QSqlQuery query) const
|
||||
{
|
||||
qCDebug(sdkdb) << "not implemented";
|
||||
}
|
||||
|
||||
QString DatabaseUtils::sqlType() const
|
||||
{
|
||||
return mSqlType;
|
||||
|
||||
@ -22,6 +22,8 @@ public:
|
||||
QSqlQuery createTable(const DatabaseTable *table, const QString table_name) const;
|
||||
|
||||
QSqlQuery insertIntoTable(const DatabaseTable *table, const QString table_name) const;
|
||||
void udpateFromSqlQuery(DatabaseTable *table, QSqlQuery query) const;
|
||||
|
||||
|
||||
QString sqlType() const;
|
||||
void setSqlType(const QString &sqlType);
|
||||
|
||||
@ -10,7 +10,6 @@
|
||||
class BookTable : public serversdk::DatabaseTable
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_CLASSINFO("default_table", "books")
|
||||
TABLE_PROPERTY(QUuid, id, set_id, QUuid());
|
||||
TABLE_PROPERTY(QString, description, set_description, "");
|
||||
TABLE_PROPERTY(QDateTime, last_update, set_last_update, QDateTime::fromSecsSinceEpoch(0));
|
||||
|
||||
@ -91,11 +91,11 @@ void SqliteTest::createTable_test()
|
||||
QSqlQuery insertQuery = utils.insertIntoTable(names.get(), "names");
|
||||
//Q_ASSERT(insertQuery.isValid());
|
||||
|
||||
|
||||
|
||||
// Select from table
|
||||
QSqlQuery selectSQL("SELECT * FROM names");
|
||||
// Q_ASSERT(db.executeQuery(selectSQL));
|
||||
|
||||
// TODO: finish -> have to use sqlPlain
|
||||
// Q_ASSERT(db.executeQselectSQL));
|
||||
while (selectSQL.next()) {
|
||||
QString value = selectSQL.value(1).toString();
|
||||
qDebug() << "value is" << value;
|
||||
|
||||
@ -54,37 +54,14 @@ void RequestManagerTest::colnodAuthorization_test()
|
||||
|
||||
|
||||
Token token;
|
||||
QVERIFY(token.id().isNull()); // must be null
|
||||
token.fromJson(data);
|
||||
|
||||
qDebug() << "token is" << token.id();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
qDebug() << "repsonse data:" << loginRequest->responseData();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (loginRequest->networkReply()->error()) {
|
||||
qDebug() << "error for reply:" << loginRequest->networkReply()->errorString();
|
||||
if (!loginRequest->responseData().isEmpty() && !loginRequest->responseData().contains("error")){
|
||||
auto jsonDoc = QJsonDocument::fromJson(loginRequest->responseData());
|
||||
QString token = jsonDoc.object()["id"].toString();
|
||||
}
|
||||
else {
|
||||
qDebug() << "Login failed.";
|
||||
}
|
||||
}
|
||||
QVERIFY(!token.id().isNull()); // mut not be null ( authentication token )
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
QTEST_MAIN(serversdk::RequestManagerTest)
|
||||
QTEST_GUILESS_MAIN(serversdk::RequestManagerTest)
|
||||
|
||||
#include "tst_requestmanager.moc"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user