mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-07-08 19:35:53 +00:00
add test support of several active profiles to gui, library and helper
This commit is contained in:
@ -23,6 +23,35 @@
|
||||
#include <netctlgui/netctlgui.h>
|
||||
|
||||
|
||||
void TestNetctl::createTestProfile()
|
||||
{
|
||||
QMap<QString, QString> settings = NetctlProfile::getRecommendedConfiguration();
|
||||
settings[QString("FORCE_SUDO")] = QString("true");
|
||||
NetctlProfile *netctl = new NetctlProfile(false, settings);
|
||||
|
||||
QMap<QString, QString> profileSettings;
|
||||
profileSettings["Connection"] = QString("dummy");
|
||||
profileSettings["Description"] = QString("Simple test profile");
|
||||
profileSettings["IP"] = QString("no");
|
||||
profileSettings["IP6"] = QString("no");
|
||||
profileSettings["Interface"] = QString("test");
|
||||
|
||||
netctl->copyProfile(netctl->createProfile(QString("aaatest"), settings));
|
||||
delete netctl;
|
||||
}
|
||||
|
||||
|
||||
void TestNetctl::removeTestProfile()
|
||||
{
|
||||
QMap<QString, QString> settings = NetctlProfile::getRecommendedConfiguration();
|
||||
settings[QString("FORCE_SUDO")] = QString("true");
|
||||
NetctlProfile *netctl = new NetctlProfile(false, settings);
|
||||
|
||||
netctl->removeProfile(QString("aaatest"));
|
||||
delete netctl;
|
||||
}
|
||||
|
||||
|
||||
void TestNetctl::test_getRecommendedConfiguration()
|
||||
{
|
||||
QStringList original;
|
||||
@ -56,7 +85,15 @@ void TestNetctl::test_getActiveProfile()
|
||||
settings[QString("FORCE_SUDO")] = QString("true");
|
||||
Netctl *netctl = new Netctl(false, settings);
|
||||
|
||||
createTestProfile();
|
||||
netctl->startProfile(QString("aaatest"));
|
||||
QString original = QString("aaatest");
|
||||
QString result = netctl->getActiveProfile();
|
||||
netctl->startProfile(QString("aaatest"));
|
||||
removeTestProfile();
|
||||
delete netctl;
|
||||
|
||||
QCOMPARE(result, original);
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,6 +28,10 @@ class TestNetctl : public QObject
|
||||
private slots:
|
||||
void test_getRecommendedConfiguration();
|
||||
void test_getActiveProfile();
|
||||
|
||||
private:
|
||||
void createTestProfile();
|
||||
void removeTestProfile();
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user