-
Notifications
You must be signed in to change notification settings - Fork 817
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test skeleton for OCC::FolderStatusModel
Signed-off-by: Matthieu Gallien <[email protected]>
- Loading branch information
Showing
4 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* | ||
* Copyright (C) by Matthieu Gallien <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
* for more details. | ||
*/ | ||
|
||
#include <QtTest> | ||
#include <QStandardPaths> | ||
#include <QAbstractItemModelTester> | ||
|
||
#include "accountstate.h" | ||
#include "folderman.h" | ||
#include "folderstatusmodel.h" | ||
#include "logger.h" | ||
#include "syncenginetestutils.h" | ||
#include "testhelper.h" | ||
|
||
using namespace OCC; | ||
using namespace OCC::Utility; | ||
|
||
class TestFolderStatusModel : public QObject | ||
{ | ||
Q_OBJECT | ||
|
||
std::unique_ptr<FolderMan> _folderMan; | ||
|
||
public: | ||
|
||
private Q_SLOTS: | ||
void initTestCase() | ||
{ | ||
Logger::instance()->setLogFlush(true); | ||
Logger::instance()->setLogDebug(true); | ||
|
||
QStandardPaths::setTestModeEnabled(true); | ||
|
||
_folderMan.reset(new FolderMan{}); | ||
} | ||
|
||
void startModel() | ||
{ | ||
FakeFolder fakeFolder{FileInfo::A12_B12_C12_S12()}; | ||
|
||
const auto account = fakeFolder.account(); | ||
const auto capabilities = QVariantMap { | ||
{QStringLiteral("end-to-end-encryption"), QVariantMap { | ||
{QStringLiteral("enabled"), true}, | ||
{QStringLiteral("api-version"), QString::number(2.0)}, | ||
}}, | ||
}; | ||
account->setCapabilities(capabilities); | ||
account->setCredentials(new FakeCredentials{fakeFolder.networkAccessManager()}); | ||
account->setUrl(QUrl(("owncloud://somehost/owncloud"))); | ||
auto accountState = FakeAccountState(account); | ||
QVERIFY(accountState.isConnected()); | ||
|
||
auto folderDef = folderDefinition(fakeFolder.localPath()); | ||
folderDef.targetPath = ""; | ||
const auto folder = FolderMan::instance()->addFolder(&accountState, folderDef); | ||
QVERIFY(folder); | ||
|
||
FolderStatusModel test; | ||
test.setAccountState(&accountState); | ||
|
||
QSKIP("Initial test implementation is known to be broken"); | ||
QAbstractItemModelTester modeltester(&test); | ||
|
||
test.fetchMore({}); | ||
} | ||
}; | ||
|
||
QTEST_MAIN(TestFolderStatusModel) | ||
Check warning on line 80 in test/testfolderstatusmodel.cpp
|
||
#include "testfolderstatusmodel.moc" |