Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
175 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* @file main.cpp | ||
* @copyright 2012 Jolla Ltd. | ||
* @author Martin Kampas <martin.kampas@tieto.com> | ||
* @date 2012 | ||
*/ | ||
|
||
#include <QtTest/QtTest> | ||
|
||
#include "libssu/sandbox_p.h" | ||
#include "repomanagertest.h" | ||
|
||
int main(int argc, char **argv){ | ||
Sandbox sandbox(QString("%1/configroot").arg(TESTS_DATA_PATH), | ||
Sandbox::UseAsSkeleton, Sandbox::ThisProcess); | ||
if (!sandbox.activate()){ | ||
qFatal("Failed to activate sandbox"); | ||
} | ||
|
||
RepoManagerTest repomanagerTest; | ||
|
||
if (QTest::qExec(&repomanagerTest, argc, argv)) | ||
return 1; | ||
|
||
return 0; | ||
} |
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,91 @@ | ||
/** | ||
* @file repomanagertest.cpp | ||
* @copyright 2013 Jolla Ltd. | ||
* @author Martin Kampas <martin.kampas@tieto.com> | ||
* @date 2013 | ||
*/ | ||
|
||
#include "repomanagertest.h" | ||
|
||
#include <QtTest/QtTest> | ||
|
||
#include "libssu/ssucoreconfig.h" | ||
#include "libssu/ssurepomanager.h" | ||
|
||
void RepoManagerTest::testSettings(){ | ||
SsuCoreConfig *const coreConfig = SsuCoreConfig::instance(); | ||
SsuRepoManager repoManager; | ||
|
||
repoManager.add("repo1", "http://repo1"); | ||
QCOMPARE(coreConfig->value("repository-urls/repo1").toString(), QString("http://repo1")); | ||
QVERIFY(!coreConfig->value("enabled-repos").toStringList().contains("repo1")); | ||
QVERIFY(!coreConfig->value("disabled-repos").toStringList().contains("repo1")); | ||
|
||
repoManager.enable("repo1"); | ||
QCOMPARE(coreConfig->value("repository-urls/repo1").toString(), QString("http://repo1")); | ||
QVERIFY(!coreConfig->value("enabled-repos").toStringList().contains("repo1")); | ||
QVERIFY(!coreConfig->value("disabled-repos").toStringList().contains("repo1")); | ||
|
||
repoManager.add("repo1"); | ||
QCOMPARE(coreConfig->value("repository-urls/repo1").toString(), QString("http://repo1")); | ||
QVERIFY(coreConfig->value("enabled-repos").toStringList().contains("repo1")); | ||
QVERIFY(!coreConfig->value("disabled-repos").toStringList().contains("repo1")); | ||
|
||
repoManager.disable("repo1"); | ||
QCOMPARE(coreConfig->value("repository-urls/repo1").toString(), QString("http://repo1")); | ||
QVERIFY(coreConfig->value("enabled-repos").toStringList().contains("repo1")); | ||
QVERIFY(coreConfig->value("disabled-repos").toStringList().contains("repo1")); | ||
|
||
repoManager.enable("repo1"); | ||
QCOMPARE(coreConfig->value("repository-urls/repo1").toString(), QString("http://repo1")); | ||
QVERIFY(coreConfig->value("enabled-repos").toStringList().contains("repo1")); | ||
QVERIFY(!coreConfig->value("disabled-repos").toStringList().contains("repo1")); | ||
|
||
repoManager.add("repo2", "http://repo2"); | ||
QCOMPARE(coreConfig->value("repository-urls/repo1").toString(), QString("http://repo1")); | ||
QVERIFY(coreConfig->value("enabled-repos").toStringList().contains("repo1")); | ||
QVERIFY(!coreConfig->value("disabled-repos").toStringList().contains("repo1")); | ||
QCOMPARE(coreConfig->value("repository-urls/repo2").toString(), QString("http://repo2")); | ||
QVERIFY(!coreConfig->value("enabled-repos").toStringList().contains("repo2")); | ||
QVERIFY(!coreConfig->value("disabled-repos").toStringList().contains("repo2")); | ||
|
||
repoManager.disable("repo2"); | ||
QCOMPARE(coreConfig->value("repository-urls/repo1").toString(), QString("http://repo1")); | ||
QVERIFY(coreConfig->value("enabled-repos").toStringList().contains("repo1")); | ||
QVERIFY(!coreConfig->value("disabled-repos").toStringList().contains("repo1")); | ||
QCOMPARE(coreConfig->value("repository-urls/repo2").toString(), QString("http://repo2")); | ||
QVERIFY(!coreConfig->value("enabled-repos").toStringList().contains("repo2")); | ||
QVERIFY(coreConfig->value("disabled-repos").toStringList().contains("repo2")); | ||
|
||
repoManager.enable("repo2"); | ||
QCOMPARE(coreConfig->value("repository-urls/repo1").toString(), QString("http://repo1")); | ||
QVERIFY(coreConfig->value("enabled-repos").toStringList().contains("repo1")); | ||
QVERIFY(!coreConfig->value("disabled-repos").toStringList().contains("repo1")); | ||
QCOMPARE(coreConfig->value("repository-urls/repo2").toString(), QString("http://repo2")); | ||
QVERIFY(!coreConfig->value("enabled-repos").toStringList().contains("repo2")); | ||
QVERIFY(!coreConfig->value("disabled-repos").toStringList().contains("repo2")); | ||
|
||
repoManager.add("repo2"); | ||
QCOMPARE(coreConfig->value("repository-urls/repo1").toString(), QString("http://repo1")); | ||
QVERIFY(coreConfig->value("enabled-repos").toStringList().contains("repo1")); | ||
QVERIFY(!coreConfig->value("disabled-repos").toStringList().contains("repo1")); | ||
QCOMPARE(coreConfig->value("repository-urls/repo2").toString(), QString("http://repo2")); | ||
QVERIFY(coreConfig->value("enabled-repos").toStringList().contains("repo2")); | ||
QVERIFY(!coreConfig->value("disabled-repos").toStringList().contains("repo2")); | ||
|
||
repoManager.remove("repo1"); | ||
QVERIFY(!coreConfig->contains("repository-urls/repo1")); | ||
QVERIFY(!coreConfig->value("enabled-repos").toStringList().contains("repo1")); | ||
QVERIFY(!coreConfig->value("disabled-repos").toStringList().contains("repo1")); | ||
QCOMPARE(coreConfig->value("repository-urls/repo2").toString(), QString("http://repo2")); | ||
QVERIFY(coreConfig->value("enabled-repos").toStringList().contains("repo2")); | ||
QVERIFY(!coreConfig->value("disabled-repos").toStringList().contains("repo2")); | ||
|
||
repoManager.remove("repo2"); | ||
QVERIFY(!coreConfig->contains("repository-urls/repo1")); | ||
QVERIFY(!coreConfig->value("enabled-repos").toStringList().contains("repo1")); | ||
QVERIFY(!coreConfig->value("disabled-repos").toStringList().contains("repo1")); | ||
QVERIFY(!coreConfig->contains("repository-urls/repo2")); | ||
QVERIFY(!coreConfig->value("enabled-repos").toStringList().contains("repo2")); | ||
QVERIFY(!coreConfig->value("disabled-repos").toStringList().contains("repo2")); | ||
} |
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,20 @@ | ||
/** | ||
* @file repomanagertest.h | ||
* @copyright 2013 Jolla Ltd. | ||
* @author Martin Kampas <martin.kampas@tieto.com> | ||
* @date 2013 | ||
*/ | ||
|
||
#ifndef _REPOMANAGERTEST_H | ||
#define _REPOMANAGERTEST_H | ||
|
||
#include <QObject> | ||
|
||
class RepoManagerTest: public QObject { | ||
Q_OBJECT | ||
|
||
private slots: | ||
void testSettings(); | ||
}; | ||
|
||
#endif |
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 @@ | ||
# empty |
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,14 @@ | ||
[General] | ||
initialized=true | ||
flavour=testing | ||
registered=false | ||
rndRelease=next | ||
release=latest | ||
adaptation= | ||
ca-certificate= | ||
credentials-scope=example | ||
credentials-url-example = http://creden.tia.ls/ | ||
|
||
[repository-urls] | ||
|
||
[repository-url-variables] |
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,16 @@ | ||
TARGET = ut_repomanager | ||
include(../testapplication.pri) | ||
include(ut_repomanager_dependencies.pri) | ||
|
||
HEADERS = \ | ||
repomanagertest.h \ | ||
|
||
SOURCES = \ | ||
main.cpp \ | ||
repomanagertest.cpp \ | ||
|
||
test_data_etc.files = \ | ||
testdata/ssu.ini \ | ||
|
||
test_data_usr_share.files = \ | ||
testdata/ssu-defaults.ini \ |
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 @@ | ||
include(../../libssu/libssu.pri) |