Commit a15927db authored by Martin Kampas's avatar Martin Kampas

ut_ssuurlresolver: initial commit

parent 639ce100
......@@ -3,6 +3,7 @@ CONFIG += qt ordered coverage debug
SUBDIRS = \
sandbox \
ut_settings \
ut_ssuurlresolver \
ut_urlresolver \
ut_variables \
......
......@@ -8,6 +8,11 @@
<step expected_result="0">/opt/tests/ssu/ut_settings</step>
</case>
</set>
<set name="ssuurlresolver" description="Test to determine if the UrlResolverPlugin works well with installed version of libzypp" feature="ssuurlresolver">
<case name="ut_ssuurlresolver" type="Functional" description="URL resolver plugin test" timeout="1000" subfeature="">
<step expected_result="0">/opt/tests/ssu/ut_ssuurlresolver</step>
</case>
</set>
<set name="urlresolver" description="Test to determine if URL resolving works properly" feature="urlresolver">
<case name="ut_urlresolver" type="Functional" description="URL resolver tests" timeout="1000" subfeature="">
<step expected_result="0">/opt/tests/ssu/ut_urlresolver</step>
......
/**
* @file main.cpp
* @copyright 2012 Jolla Ltd.
* @author Martin Kampas <martin.kampas@tieto.com>
* @date 2012
*/
#include <QtTest/QtTest>
#include "ssuurlresolvertest.h"
int main(int argc, char **argv){
SsuUrlResolverTest ssuUrlResolverTest;
if (QTest::qExec(&ssuUrlResolverTest, argc, argv))
return 1;
return 0;
}
/**
* @file ssuurlresolvertest.cpp
* @copyright 2013 Jolla Ltd.
* @author Martin Kampas <martin.kampas@tieto.com>
* @date 2013
*/
#include "ssuurlresolvertest.h"
#include <stdlib.h>
#include <zypp/media/UrlResolverPlugin.h>
#include <QtTest/QtTest>
/**
* @class SsuUrlResolverTest
* @brief Tests libzypp UrlResolverPlugin plugin compatibility
*
* This test verifies the UrlResolverPlugin works well with installed version of libzypp.
*/
void SsuUrlResolverTest::initTestCase(){
setenv("LD_PRELOAD", qPrintable(QString("%1/libsandboxhook.so").arg(TESTS_PATH)), 1);
setenv("SSU_TESTS_SANDBOX", qPrintable(QString("%1/configroot").arg(TESTS_DATA_PATH)), 1);
}
void SsuUrlResolverTest::test_data(){
QTest::addColumn<QString>("input");
QTest::addColumn<QString>("expected");
QTest::newRow("basic")
<< "plugin:ssu?repo=mer-core&debug&arch=i586"
<< "https://packages.testing.com//mer/i586/debug/?credentials=example";
}
void SsuUrlResolverTest::test(){
QFETCH(QString, input);
QFETCH(QString, expected);
zypp::media::UrlResolverPlugin::HeaderList customHeaders;
const QString resolved = QString::fromStdString(
zypp::media::UrlResolverPlugin::resolveUrl(input.toStdString(), customHeaders).asString());
QCOMPARE(resolved, expected);
}
/**
* @file ssuurlresolvertest.h
* @copyright 2013 Jolla Ltd.
* @author Martin Kampas <martin.kampas@tieto.com>
* @date 2013
*/
#ifndef _SSUURLRESOLVERTEST_H
#define _SSUURLRESOLVERTEST_H
#include <QObject>
class SsuUrlResolverTest: public QObject {
Q_OBJECT
private slots:
void initTestCase();
void test_data();
void test();
private:
};
#endif
[file.exists]
SDK=/mer-sdk-chroot
[systeminfo.equals]
[cpuinfo.contains]
N900=Nokia RX-51 board
N950=Nokia RM-680 board
N9=Nokia RM-696 board
[arch.equals]
generic-x86=i586
[variants]
N950=N9
[N9]
family=n950-n9
adaptation-repos=n9xx-common,n950-n9
[N900]
family=n900
adaptation-repos=n9xx-common,n900
[SDK]
[generic-x86]
family=x86
adaptation-repos=x86
[UNKNOWN]
family=UNKNOWN
[all]
credentials=jolla
credentials-url=https://%(ssuRegDomain)/%(ssuRegPath)/%1/credentials.xml
register-url=https://%(ssuRegDomain)/%(ssuRegPath)/%1/register.xml
[release]
mer-core=https://%(packagesDomain)/%(release)/mer/%(arch)/%(debugSplit)/
[rnd]
mer-core=https://%(packagesDomain)/mer/%(release)/builds/%(arch)/%(debugSplit)/
[devel-flavour]
flavour-pattern=
[release-flavour]
flavour-pattern=:/release
[testing-flavour]
flavour-pattern=:/testing
[example-domain]
dumpDomain=dump.example.com
packagesDomain=packages.example.com
ssuRegDomain=ssu.example.com
ssuRegPath=ssu/device
# fallback if domain is not matched or not set
[default-domain]
dumpDomain=dump.testing.com
packagesDomain=packages.testing.com
ssuRegDomain=ssu.testing.com
ssuRegPath=ssu/device
[General]
initialized=true
flavour=testing
registered=false
rndRelease=latest
release=
adaptation=
ca-certificate=
credentials-scope=example
[repository-urls]
[repository-url-variables]
HEADERS = \
ssuurlresolvertest.h \
SOURCES = \
main.cpp \
ssuurlresolvertest.cpp \
TEMPLATE = app
TARGET = ut_ssuurlresolver
LIBS += \
-lssu \
-lzypp \
CONFIG -= app_bundle
CONFIG += console qtestlib
QT -= gui
QT += network testlib
!include( ../tests.pri ) { error("Unable to find tests include") }
unix:target.path = $${PREFIX}/$$TESTS_PATH
INSTALLS += target
test_data_etc.path = $${TESTS_DATA_PATH}/configroot/etc/ssu
test_data_etc.files = \
$${PWD}/testdata/ssu.ini \
test_data_usr_share.path = $${TESTS_DATA_PATH}/configroot/usr/share/ssu
test_data_usr_share.files = \
$${PWD}/testdata/ssu-defaults.ini \
$${PWD}/testdata/repos.ini \
$${PWD}/testdata/board-mappings.ini \
INSTALLS += test_data_etc test_data_usr_share
!include( ../../buildpath.pri ) { error("Unable to find build path specification") }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment