[libcalamares] Add tests for network service

This commit is contained in:
Adriaan de Groot 2019-08-20 09:51:39 -04:00
parent d7602df51e
commit b8d56bb4a6
3 changed files with 90 additions and 0 deletions

View File

@ -197,6 +197,16 @@ if ( ECM_FOUND AND BUILD_TESTING )
Qt5::Test
)
calamares_automoc( libcalamareslocaletest )
ecm_add_test(
network/Tests.cpp
TEST_NAME
libcalamaresnetworktest
LINK_LIBRARIES
calamares
Qt5::Test
)
calamares_automoc( libcalamaresnetworktest )
endif()
if( BUILD_TESTING )

View File

@ -0,0 +1,43 @@
/* === This file is part of Calamares - <https://github.com/calamares> ===
*
* Copyright 2019, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Calamares is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Tests.h"
#include "Manager.h"
#include <QtTest/QtTest>
QTEST_GUILESS_MAIN( NetworkTests )
NetworkTests::NetworkTests()
{
}
NetworkTests::~NetworkTests()
{
}
void NetworkTests::initTestCase()
{
}
void NetworkTests::testInstance()
{
auto& nam = CalamaresUtils::Network::Manager::instance();
QVERIFY( !nam.hasInternet() );
}

View File

@ -0,0 +1,37 @@
/* === This file is part of Calamares - <https://github.com/calamares> ===
*
* Copyright 2019, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Calamares is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBCALAMARES_NETWORK_TESTS_H
#define LIBCALAMARES_NETWORK_TESTS_H
#include <QObject>
class NetworkTests : public QObject
{
Q_OBJECT
public:
NetworkTests();
~NetworkTests() override;
private Q_SLOTS:
void initTestCase();
void testInstance();
};
#endif