fix unittest

This commit is contained in:
Ondřej Fischer 2020-02-10 10:35:35 +01:00
parent 3c68cd64f2
commit 96b32c222c
3 changed files with 3 additions and 4 deletions

View File

@ -22,7 +22,7 @@ int main(int argc, char *argv[])
parser.setApplicationDescription("Colnod sync"); parser.setApplicationDescription("Colnod sync");
QCommandLineOption dryModeOption("dryMode", "ColnodAPI", "Read-only mode, prints changes which would normally be made"); QCommandLineOption dryModeOption("dryMode", "ColnodAPI", "Read-only mode, prints changes which would normally be made");
QCommandLineOption dropTablesOption("dropTables", "ColnodAPI", "Delete tables with datas from Colnod"); QCommandLineOption dropTablesOption("dropTables", "ColnodAPI", "Delete tables with datas from Colnod");
QCommandLineOption createTablesOption("createTables", "ColnodAPI", "Create tables to saving data from Colnod"); QCommandLineOption createTablesOption("createTables", "ColnodAPI", "Create tables for saving data from Colnod");
parser.addOption(dryModeOption); parser.addOption(dryModeOption);
parser.addOption(dropTablesOption); parser.addOption(dropTablesOption);
parser.addOption(createTablesOption); parser.addOption(createTablesOption);
@ -40,7 +40,6 @@ int main(int argc, char *argv[])
QLoggingCategory::setFilterRules(filters.join(QStringLiteral("\n"))); QLoggingCategory::setFilterRules(filters.join(QStringLiteral("\n")));
SyncManager syncManager(parser.isSet(dryModeOption)); SyncManager syncManager(parser.isSet(dryModeOption));
// Initialize database and colnod API // Initialize database and colnod API

View File

@ -292,7 +292,7 @@ int DatabaseAPI::exists(const QString &id, const QString &tableName)
qint16 DatabaseAPI::getNumOfTokensOfSubject(const QString &id) qint16 DatabaseAPI::getNumOfTokensOfSubject(const QString &id)
{ {
auto query = mDbMan->createQuery(); auto query = mDbMan->createQuery();
query.prepare("SELECT 1 FROM colnod_token WHERE subject_id = :id AND deleted = false"); query.prepare("SELECT 1 FROM colnod_token WHERE subject_id = :id AND description = 'mobile'");
query.bindValue(":id", id); query.bindValue(":id", id);
if (!executeQuery(query)) { if (!executeQuery(query)) {
qCritical(database) << "ERROR during accessing existing tokens. EXIT(1)"; qCritical(database) << "ERROR during accessing existing tokens. EXIT(1)";

View File

@ -55,7 +55,7 @@ void ColnodTest::download_data_test()
QVERIFY(data); QVERIFY(data);
QVERIFY(! data->updatedTokens.isEmpty()); QVERIFY(! data->updatedTokens.isEmpty());
QVERIFY(data->updatedTokens.contains("5e2f1260-da1c-441f-9644-24dfe3b97b2a")); QVERIFY(data->updatedTokens.contains("6c907a42-0401-4403-8af4-9d58eb35cddc"));
} }
void ColnodTest::download_data_test_now() void ColnodTest::download_data_test_now()