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 #48 from nemomobile/jb32346
Allow defining url domains to be used with specific credentials
- Loading branch information
Showing
11 changed files
with
211 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,8 @@ doc/latex | |
/rndssucli/ssuproxy.h | ||
/.nodocs | ||
ssucli/ssuproxy.h | ||
*.o | ||
RPMS/ | ||
installroot/ | ||
moc_*.cpp | ||
qrc_*.cpp |
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,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 "ssutest.h" | ||
|
||
int main(int argc, char **argv){ | ||
Sandbox sandbox(QString("%1/configroot").arg(LOCATE_DATA_PATH), | ||
Sandbox::UseAsSkeleton, Sandbox::ThisProcess); | ||
if (!sandbox.activate()){ | ||
qFatal("Failed to activate sandbox"); | ||
} | ||
|
||
SsuTest ssuTest; | ||
|
||
if (QTest::qExec(&ssuTest, 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,67 @@ | ||
/** | ||
* @file repomanagertest.cpp | ||
* @copyright 2015 Jolla Ltd. | ||
* @author Marko Saukko <marko.saukko@jolla.com> | ||
* @date 2015 | ||
* @todo Add unit tests for other ssu lib functions. | ||
*/ | ||
|
||
#include "ssutest.h" | ||
|
||
#include <QtTest/QtTest> | ||
|
||
#include "libssu/ssucoreconfig_p.h" | ||
#include "libssu/ssurepomanager.h" | ||
#include "libssu/ssu.h" | ||
|
||
void SsuTest::initTestCase(){ | ||
} | ||
|
||
void SsuTest::testCredentialsScope(){ | ||
// For store repo store is returned always no matter what | ||
QCOMPARE(ssu.credentialsScope(QString("store")),QString("store")); | ||
QCOMPARE(ssu.credentialsScope(QString("store-c-example")),QString("store")); | ||
|
||
ssu.setDomain(QString("default")); | ||
QCOMPARE(ssu.domain(),QString("default")); | ||
|
||
QCOMPARE(ssu.credentialsScope(QString("store")),QString("store")); | ||
QCOMPARE(ssu.credentialsScope(QString("apps")),QString("vendor")); | ||
QCOMPARE(ssu.credentialsScope(QString("vendor")),QString("vendor")); | ||
|
||
QCOMPARE(ssu.credentialsScope(QString("store"),true),QString("store")); | ||
QCOMPARE(ssu.credentialsScope(QString("adaptation"),true),QString("vendor")); | ||
QCOMPARE(ssu.credentialsScope(QString("oss"),true),QString("vendor")); | ||
} | ||
|
||
void SsuTest::testCredentialsScopeStoreAuthRepos() { | ||
ssu.setDomain(QString("example")); | ||
QCOMPARE(ssu.domain(),QString("example")); | ||
|
||
QCOMPARE(ssu.credentialsScope(QString("store")),QString("store")); | ||
// store-auth-repos=apps in example domain | ||
QCOMPARE(ssu.credentialsScope(QString("apps")),QString("store")); | ||
QCOMPARE(ssu.credentialsScope(QString("vendor")),QString("vendor")); | ||
|
||
QCOMPARE(ssu.credentialsScope(QString("store"),true),QString("store")); | ||
QCOMPARE(ssu.credentialsScope(QString("adaptation"),true),QString("vendor")); | ||
QCOMPARE(ssu.credentialsScope(QString("oss"),true),QString("vendor")); | ||
} | ||
|
||
void SsuTest::testCredentialsScopeSecureDomainAuth(){ | ||
// [secure-domain-auth] | ||
// packages.example2.com=example2 | ||
|
||
ssu.setDomain("example2"); | ||
QCOMPARE(ssu.domain(),QString("example2")); | ||
|
||
QCOMPARE(ssu.credentialsScope(QString("store"),false),QString("store")); | ||
QCOMPARE(ssu.credentialsScope(QString("apps"),false),QString("example2")); | ||
QCOMPARE(ssu.credentialsScope(QString("vendor"),false),QString("example2")); | ||
|
||
// adaptation uses packages.example2.com | ||
QCOMPARE(ssu.credentialsScope(QString("adaptation"),true),QString("example2")); | ||
// oss uses dump.example2.com, thus vendor | ||
QCOMPARE(ssu.credentialsScope(QString("oss"),true),QString("vendor")); | ||
} | ||
|
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,28 @@ | ||
/** | ||
* @file repomanagertest.h | ||
* @copyright 2015 Jolla Ltd. | ||
* @author Marko Saukko <marko.saukko@jolla.com> | ||
* @date 2015 | ||
*/ | ||
|
||
#ifndef _SSUTEST_H | ||
#define _SSUTEST_H | ||
|
||
#include <QObject> | ||
#include <QStringList> | ||
|
||
#include "libssu/ssu.h" | ||
|
||
class SsuTest: public QObject { | ||
Q_OBJECT | ||
|
||
private slots: | ||
void initTestCase(); | ||
void testCredentialsScope(); | ||
void testCredentialsScopeStoreAuthRepos(); | ||
void testCredentialsScopeSecureDomainAuth(); | ||
private: | ||
Ssu ssu; | ||
}; | ||
|
||
#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,45 @@ | ||
[all] | ||
credentials=vendor | ||
store=https://%(packagesDomain)/store/ | ||
|
||
[release] | ||
vendor=https://%(packagesDomain)/releases/%(release)/vendor/%(arch)/ | ||
apps=https://%(packagesDomain)/releases/%(release)/vendor-apps/%(arch)/ | ||
|
||
[rnd] | ||
mer-core=https://%(packagesDomain)/mer/%(release)/builds/%(arch)/%(debugSplit)/ | ||
adaptation=https://%(packagesDomain)/nemo/%(release)/adaptation-%(deviceFamily)/%(arch)/ | ||
nemo=https://%(packagesDomain)/nemo/%(release)/platform/%(arch)/ | ||
non-oss=https://%(dumpDomain)/pj:/non-oss%(flavour)/%(release)_%(arch)/ | ||
oss=https://%(dumpDomain)/pj:/oss%(flavour)/%(release)_%(arch)/ | ||
|
||
[devel-flavour] | ||
flavour-pattern= | ||
|
||
[release-flavour] | ||
flavour-pattern=:/release | ||
|
||
[testing-flavour] | ||
flavour-pattern=:/testing | ||
|
||
[example-domain] | ||
dumpDomain=dump.example.com | ||
packagesDomain=packages.example.com | ||
store-auth-repos=apps | ||
|
||
[example2-domain] | ||
dumpDomain=dump.example2.com | ||
packagesDomain=packages.example2.com | ||
|
||
# fallback if domain is not matched or not set | ||
[default-domain] | ||
dumpDomain=dump.testing.com | ||
packagesDomain=packages.testing.com | ||
|
||
[default-repos] | ||
release=vendor,apps | ||
rnd=mer-core,adaptation,nemo,non-oss,oss | ||
|
||
[secure-domain-auth] | ||
packages.example2.com=example2 | ||
|
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,3 @@ | ||
[General] | ||
credentials-scope=vendor | ||
|
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,17 @@ | ||
TARGET = ut_ssu | ||
include(../testapplication.pri) | ||
include(ut_ssu_dependencies.pri) | ||
|
||
HEADERS = \ | ||
ssutest.h \ | ||
|
||
SOURCES = \ | ||
main.cpp \ | ||
ssutest.cpp \ | ||
|
||
test_data_etc.files = \ | ||
testdata/ssu.ini \ | ||
|
||
test_data_usr_share.files = \ | ||
testdata/repos.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) |