Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Merge pull request #10 from martyone/master
sandbox code/doc polishing, add ut_coreconfig, add ut_sandbox, fix debug mode, extend ut_urlresolver, add ut_deviceinfo, add ut_repomanager
- Loading branch information
Showing
51 changed files
with
1,084 additions
and
30 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
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
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,86 @@ | ||
/** | ||
* @file coreconfigtest.cpp | ||
* @copyright 2013 Jolla Ltd. | ||
* @author Martin Kampas <martin.kampas@tieto.com> | ||
* @date 2013 | ||
*/ | ||
|
||
#include "coreconfigtest.h" | ||
|
||
#include <QtTest/QtTest> | ||
|
||
#include "libssu/ssucoreconfig.h" | ||
|
||
void CoreconfigTest::testCredentialsScope(){ | ||
QCOMPARE(SsuCoreConfig::instance()->credentialsScope("/*ignored*/", false), QString("example")); | ||
|
||
} | ||
|
||
void CoreconfigTest::testCredentials(){ | ||
QCOMPARE(SsuCoreConfig::instance()->credentials("example").first, QString("example_username")); | ||
QCOMPARE(SsuCoreConfig::instance()->credentials("example").second, QString("example_password")); | ||
} | ||
|
||
void CoreconfigTest::testCredentialsUrl(){ | ||
QCOMPARE(SsuCoreConfig::instance()->credentialsUrl("example"), QString("http://creden.tia.ls/")); | ||
} | ||
|
||
void CoreconfigTest::testFlavour(){ | ||
QCOMPARE(SsuCoreConfig::instance()->flavour(), QString("testing")); | ||
SsuCoreConfig::instance()->setFlavour("release"); | ||
QCOMPARE(SsuCoreConfig::instance()->flavour(), QString("release")); | ||
} | ||
|
||
void CoreconfigTest::testDeviceMode(){ | ||
SsuCoreConfig::instance()->remove("deviceMode"); | ||
QCOMPARE(SsuCoreConfig::instance()->deviceMode(), (int)Ssu::ReleaseMode); | ||
SsuCoreConfig::instance()->setDeviceMode(Ssu::ReleaseMode, Ssu::Add); | ||
QCOMPARE(SsuCoreConfig::instance()->deviceMode(), (int)Ssu::ReleaseMode); | ||
SsuCoreConfig::instance()->setDeviceMode(Ssu::LenientMode, Ssu::Add); | ||
QCOMPARE(SsuCoreConfig::instance()->deviceMode(), (int)Ssu::ReleaseMode | Ssu::LenientMode); | ||
SsuCoreConfig::instance()->setDeviceMode(Ssu::ReleaseMode, Ssu::Remove); | ||
QCOMPARE(SsuCoreConfig::instance()->deviceMode(), (int)Ssu::LenientMode); | ||
SsuCoreConfig::instance()->setDeviceMode(Ssu::ReleaseMode, Ssu::Replace); | ||
QCOMPARE(SsuCoreConfig::instance()->deviceMode(), (int)Ssu::ReleaseMode); | ||
} | ||
|
||
void CoreconfigTest::testDomain(){ | ||
QCOMPARE(SsuCoreConfig::instance()->domain(), QString("")); | ||
SsuCoreConfig::instance()->setDomain("foo"); | ||
QCOMPARE(SsuCoreConfig::instance()->domain(), QString("foo")); | ||
} | ||
|
||
void CoreconfigTest::testRegistered(){ | ||
QCOMPARE(SsuCoreConfig::instance()->isRegistered(), false); | ||
SsuCoreConfig::instance()->setValue("registered", true); | ||
QCOMPARE(SsuCoreConfig::instance()->isRegistered(), false); | ||
SsuCoreConfig::instance()->setValue("privateKey", "fooKey"); | ||
QCOMPARE(SsuCoreConfig::instance()->isRegistered(), false); | ||
SsuCoreConfig::instance()->setValue("certificate", "fooCert"); | ||
QCOMPARE(SsuCoreConfig::instance()->isRegistered(), true); | ||
} | ||
|
||
void CoreconfigTest::testLastCredentialsUpdate(){ | ||
QCOMPARE(SsuCoreConfig::instance()->lastCredentialsUpdate(), QDateTime()); | ||
SsuCoreConfig::instance()->setValue("lastCredentialsUpdate", | ||
QDateTime::fromString("2013-04-08", Qt::ISODate)); | ||
QCOMPARE(SsuCoreConfig::instance()->lastCredentialsUpdate(), | ||
QDateTime::fromString("2013-04-08", Qt::ISODate)); | ||
} | ||
|
||
void CoreconfigTest::testRelease(){ | ||
QCOMPARE(SsuCoreConfig::instance()->release(false), QString("latest")); | ||
QCOMPARE(SsuCoreConfig::instance()->release(true), QString("next")); | ||
SsuCoreConfig::instance()->setRelease("next", false); | ||
QCOMPARE(SsuCoreConfig::instance()->release(false), QString("next")); | ||
QCOMPARE(SsuCoreConfig::instance()->release(true), QString("next")); | ||
SsuCoreConfig::instance()->setRelease("latest", true); | ||
QCOMPARE(SsuCoreConfig::instance()->release(false), QString("next")); | ||
QCOMPARE(SsuCoreConfig::instance()->release(true), QString("latest")); | ||
} | ||
|
||
void CoreconfigTest::testSslVerify(){ | ||
QCOMPARE(SsuCoreConfig::instance()->useSslVerify(), true); | ||
SsuCoreConfig::instance()->setValue("ssl-verify", false); | ||
QCOMPARE(SsuCoreConfig::instance()->useSslVerify(), false); | ||
} |
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,29 @@ | ||
/** | ||
* @file coreconfigtest.h | ||
* @copyright 2013 Jolla Ltd. | ||
* @author Martin Kampas <martin.kampas@tieto.com> | ||
* @date 2013 | ||
*/ | ||
|
||
#ifndef _CORECONFIGTEST_H | ||
#define _CORECONFIGTEST_H | ||
|
||
#include <QObject> | ||
|
||
class CoreconfigTest: public QObject { | ||
Q_OBJECT | ||
|
||
private slots: | ||
void testCredentialsScope(); | ||
void testCredentials(); | ||
void testCredentialsUrl(); | ||
void testFlavour(); | ||
void testDeviceMode(); | ||
void testDomain(); | ||
void testRegistered(); | ||
void testLastCredentialsUpdate(); | ||
void testRelease(); | ||
void testSslVerify(); | ||
}; | ||
|
||
#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,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 "coreconfigtest.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"); | ||
} | ||
|
||
CoreconfigTest coreconfigTest; | ||
|
||
if (QTest::qExec(&coreconfigTest, 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 @@ | ||
# 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,18 @@ | ||
[General] | ||
initialized=true | ||
flavour=testing | ||
registered=false | ||
rndRelease=next | ||
release=latest | ||
adaptation= | ||
ca-certificate= | ||
credentials-scope=example | ||
credentials-url-example = http://creden.tia.ls/ | ||
|
||
[credentials-example] | ||
username = example_username | ||
password = example_password | ||
|
||
[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_coreconfig | ||
include(../testapplication.pri) | ||
include(ut_coreconfig_dependencies.pri) | ||
|
||
HEADERS = \ | ||
coreconfigtest.h \ | ||
|
||
SOURCES = \ | ||
main.cpp \ | ||
coreconfigtest.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,2 @@ | ||
include(../../libssu/libssu.pri) | ||
include(../testutils/testutils.pri) |
Oops, something went wrong.