1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-06-25 02:19:37 +02:00

test: Remove FWWindowTest

This test is no longer valid, as the version
check is no longer used.
This commit is contained in:
Sirius Bakke
2020-03-19 01:03:56 +01:00
parent c20b274b04
commit 30ef5fe4ed
10 changed files with 51 additions and 348 deletions

View File

@@ -372,7 +372,6 @@ set(libgui_hdrs
heartbeatOptionsDialog.h
openaisOptionsDialog.h
pfsyncOptionsDialog.h
#check_update_url.h
#startup_tip_url.h
InterfaceEditorWidget.h
#FWCmdBasic.h

View File

@@ -30,7 +30,6 @@
#include "version.h"
#include "global.h"
#include "check_update_url.h"
#include "utils.h"
#include "utils_no_qt.h"
@@ -169,7 +168,7 @@
#include <qtimer.h>
#include <qtoolbutton.h>
#include <QTemporaryDir>
extern bool regCheck();
using namespace libfwbuilder;
@@ -454,7 +453,7 @@ void FWWindow::showSub(ProjectPanel *pp)
pp->setWindowState(Qt::WindowMaximized);
else
pp->setWindowState(Qt::WindowNoState);
sub->show();
/*
* for reasons I do not understand, QMdiArea does not send signal
@@ -565,7 +564,7 @@ void FWWindow::showIntroDialog()
msg_box.setInformativeText(tr("The guide will open in the web browser"));
QCheckBox cb(tr("Do not show this again"), &msg_box);
msg_box.addButton(&cb, QMessageBox::ResetRole); // is this role right ?
QPushButton *watch_button =
QPushButton *watch_button =
msg_box.addButton(tr("Watch the guide"), QMessageBox::AcceptRole);
msg_box.addButton(QMessageBox::Close);
@@ -825,7 +824,7 @@ void FWWindow::importPolicy()
{
if (!activeProject()->m_panel->om->isObjectAllowed(Firewall::TYPENAME))
return;
ImportFirewallConfigurationWizard wiz(this, db());
wiz.exec();
}

View File

@@ -30,7 +30,6 @@
#include "global.h"
#include "check_update_url.h"
#include "utils.h"
#include "platforms.h"
@@ -638,7 +637,7 @@ void PrefsDialog::accept()
st->setDiffPath( m_dialog->diffPath->text() );
st->setBool("Environment/RememberSshPassEnabled", m_dialog->rememberSshPass->isChecked());
st->setCheckUpdates(m_dialog->checkUpdates->isChecked());
st->setDiffColor(FWBSettings::ADD_COLOR, colors[FWBSettings::ADD_COLOR]);

View File

@@ -1,34 +0,0 @@
/*
Firewall Builder
Copyright (C) 2008 NetCitadel, LLC
Author: Vadim Kurland vadim@fwbuilder.org
$Id$
This program is free software which we release under the GNU General Public
License. You may redistribute and/or modify this program under the terms
of that license as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program 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.
To get a copy of the GNU General Public License, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef CHECK_UPDATE_URL_HH
#define CHECK_UPDATE_URL_HH
#define CHECK_UPDATE_URL "http://update.fwbuilder.org/update_checks/check.cgi?v=%1&uuid=%2"
#endif

View File

@@ -15,7 +15,6 @@ add_subdirectory(DNSTest)
add_subdirectory(FirewallDialogTest)
add_subdirectory(FWBTreeTest)
add_subdirectory(FWObjectTest)
add_subdirectory(FWWindowTest)
add_subdirectory(generatedScriptTestsIpfilter)
add_subdirectory(generatedScriptTestsIpfw)
add_subdirectory(generatedScriptTestsLinux)

View File

@@ -1,8 +0,0 @@
SET(CMAKE_AUTOMOC ON)
add_executable(FWWindowTest FWWindowTest.cpp main_FWWindowTest.cpp)
add_test(NAME FWWindowTest COMMAND FWWindowTest)
target_link_libraries(FWWindowTest PRIVATE test_main gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder netsnmp xml2 xslt z pthread Qt5::Test)
#target_link_libraries(fwb_ipt common iptlib compilerdriver fwcompiler fwbuilder xml2 pthread m xslt z)
#target_link_libraries(fwbuilder-gui gui import fwbparser antlr common iptlib fwbpf fwbjuniper fwbcisco compilerdriver fwcompiler fwbuilder xml2 m xslt z OpenSSL::Crypto pthread)

View File

@@ -1,132 +0,0 @@
/*
Firewall Builder
Copyright (C) 2010 NetCitadel, LLC
Author: Roman Bovsunivskiy a2k0001@gmail.com
$Id$
This program is free software which we release under the GNU General Public
License. You may redistribute and/or modify this program under the terms
of that license as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program 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.
To get a copy of the GNU General Public License, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "FWWindowTest.h"
#include "FWWindow.h"
#include <QFile>
#include "global.h"
#include "FWBSettings.h"
#include <QMessageBox>
#include <QDebug>
#include <QTimer>
FWWindowTest::FWWindowTest(QWidget *parent)
: QMainWindow(parent)
{
}
void FWWindowTest::initTestCase()
{
st->setCheckUpdates(true);
st->setBool("UI/NoStartTip", true);
}
void FWWindowTest::cleanupTestCase()
{
if (QFile::exists("/tmp/update_4.0.0"))
qDebug() << "file /tmp/update_4.0.0 exists";
QFile::remove("/tmp/update_4.0.0");
}
void FWWindowTest::findMessageBox()
{
QList<QMessageBox*> boxes = mw->findChildren<QMessageBox*>();
QVERIFY(!boxes.empty());
bool found = false;
foreach(QMessageBox *box, boxes)
{
if (box->text().contains("http://www.fwbuilder.org"))
{
found = true;
box->reject();
break;
}
}
QVERIFY(found);
}
void FWWindowTest::findNoMessageBox()
{
QList<QMessageBox*> boxes = mw->findChildren<QMessageBox*>();
if (!boxes.isEmpty())
boxes.first()->reject();
QVERIFY(boxes.empty());
}
void FWWindowTest::prepareMW()
{
mw = new FWWindow();
mw->show();
QFile updatefile("/tmp/update_4.0.0");
updatefile.open(QFile::ReadWrite);
updatefile.write("update = 1\n");
updatefile.close();
setenv("FWBUILDER_CHECK_UPDATE_URL", "file:///tmp/update_4.0.0", 1);
st->setCheckUpdates(true);
}
void FWWindowTest::checkForUpgrade_1()
{
prepareMW();
st->setTimeOfLastUpdateAvailableWarning(0);
QTimer::singleShot(1000, this, SLOT(findMessageBox()));
mw->startupLoad();
QTest::qWait(1500);
mw->hide();
}
void FWWindowTest::checkForUpgrade_2()
{
prepareMW();
st->setTimeOfLastUpdateAvailableWarning(QDateTime::currentDateTime().addSecs(-60*60*25).toTime_t());
QTimer::singleShot(1000, this, SLOT(findMessageBox()));
mw->startupLoad();
QTest::qWait(1500);
mw->hide();
}
void FWWindowTest::checkForUpgrade_3()
{
prepareMW();
st->setTimeOfLastUpdateAvailableWarning(QDateTime::currentDateTime().addSecs(-60*60*2).toTime_t());
QTimer::singleShot(1000, this, SLOT(findNoMessageBox()));
mw->startupLoad();
QTest::qWait(1500);
mw->hide();
}
void FWWindowTest::checkForUpgrade_4()
{
prepareMW();
QFile updatefile("/tmp/update_4.0.0");
updatefile.open(QFile::WriteOnly);
updatefile.resize(0);
updatefile.close();
st->setTimeOfLastUpdateAvailableWarning(QDateTime::currentDateTime().addSecs(-60*60*25).toTime_t());
QTimer::singleShot(1000, this, SLOT(findNoMessageBox()));
mw->startupLoad();
QTest::qWait(1500);
mw->hide();
}

View File

@@ -1,54 +0,0 @@
/*
Firewall Builder
Copyright (C) 2010 NetCitadel, LLC
Author: Roman Bovsunivskiy a2k0001@gmail.com
$Id$
This program is free software which we release under the GNU General Public
License. You may redistribute and/or modify this program under the terms
of that license as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program 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.
To get a copy of the GNU General Public License, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef FWWINDOWTEST_H
#define FWWINDOWTEST_H
#include <QMainWindow>
#include <QTest>
#include <QMessageBox>
class FWWindowTest : public QMainWindow
{
Q_OBJECT;
public:
FWWindowTest(QWidget *parent = 0);
public slots:
void findMessageBox();
void findNoMessageBox();
void prepareMW();
private slots:
void initTestCase();
void cleanupTestCase();
void checkForUpgrade_1();
void checkForUpgrade_2();
void checkForUpgrade_3();
void checkForUpgrade_4();
};
#endif // FWWINDOWTEST_H

View File

@@ -1,65 +0,0 @@
/*
Firewall Builder
Copyright (C) 2010 NetCitadel, LLC
Author: Roman Bovsunivskiy a2k0001@gmail.com
$Id$
This program is free software which we release under the GNU General Public
License. You may redistribute and/or modify this program under the terms
of that license as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program 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.
To get a copy of the GNU General Public License, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "FWWindowTest.h"
#include <QTest>
#include <QFile>
#include "FWWindow.h"
#include "FWBSettings.h"
#include "FWBApplication.h"
using namespace std;
using namespace libfwbuilder;
int fwbdebug = 0;
FWWindow *mw = nullptr;
FWBSettings *st = nullptr;
FWBApplication *app = nullptr;
extern void build_app(int argc, char** argv,
FWBApplication** app,
FWBSettings** st);
int main(int argc, char** argv)
{
app = new FWBApplication(argc, argv);
app->setOrganizationName(QLatin1String("NetCitadel"));
app->setApplicationName(QLatin1String("Firewall Builder"));
build_app(argc, argv, &app, &st);
int testResult = QTest::qExec(new FWWindowTest());
if (QFile::exists("test_work.fwb"))
QFile::remove("test_work.fwb");
return testResult;
}

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE FWObjectDatabase SYSTEM "fwbuilder.dtd">
<FWObjectDatabase xmlns="http://www.fwbuilder.org/1.0/" version="24" lastModified="1317585465" id="root">
<FWObjectDatabase xmlns="http://www.fwbuilder.org/1.0/" version="22" lastModified="1317585465" id="root">
<Library id="syslib000" color="#d4f8ff" name="Standard" comment="Standard objects" ro="True">
<AnyNetwork id="sysid0" name="Any" comment="Any Network" ro="False" address="0.0.0.0" netmask="0.0.0.0"/>
<AnyIPService id="sysid1" protocol_num="0" name="Any" comment="Any IP Service" ro="False"/>
@@ -51,9 +51,9 @@
<PolicyInstallScript arguments="" command="" enabled="False"/>
</Management>
<HostOptions>
<Option name="snmp_contact"/>
<Option name="snmp_description"/>
<Option name="snmp_location"/>
<Option name="snmp_contact"></Option>
<Option name="snmp_description"></Option>
<Option name="snmp_location"></Option>
<Option name="use_mac_addr">false</Option>
<Option name="use_mac_addr_filter">False</Option>
</HostOptions>
@@ -69,9 +69,9 @@
<PolicyInstallScript arguments="" command="" enabled="False"/>
</Management>
<HostOptions>
<Option name="snmp_contact"/>
<Option name="snmp_description"/>
<Option name="snmp_location"/>
<Option name="snmp_contact"></Option>
<Option name="snmp_description"></Option>
<Option name="snmp_location"></Option>
<Option name="use_mac_addr">false</Option>
<Option name="use_mac_addr_filter">False</Option>
</HostOptions>
@@ -107,17 +107,17 @@
</ObjectGroup>
<ServiceGroup id="stdid05" name="Services" comment="" ro="False">
<CustomService id="stdid14_1" name="ESTABLISHED" comment="This service matches all packets which are part of network connections established through the firewall, or connections 'related' to those established through the firewall. Term 'established' refers to the state tracking mechanism which exists inside iptables and other stateful firewalls and does not mean any particular combination of packet header options. Packet is considered to correspond to the state 'ESTABLISHED' if it belongs to the network session, for which proper initiation has been seen by the firewall, so its stateful inspection module made appropriate record in the state table. Usually stateful firewalls keep track of network connections using not only tcp protocol, but also udp and sometimes even icmp protocols. 'RELATED' describes packet belonging to a separate network connection, related to the session firewall is keeping track of. One example is FTP command and FTP data sessions." ro="False" protocol="any" address_family="ipv4">
<CustomServiceCommand platform="Undefined"/>
<CustomServiceCommand platform="Undefined"></CustomServiceCommand>
<CustomServiceCommand platform="iosacl">established</CustomServiceCommand>
<CustomServiceCommand platform="ipfilter"/>
<CustomServiceCommand platform="ipfilter"></CustomServiceCommand>
<CustomServiceCommand platform="ipfw">established</CustomServiceCommand>
<CustomServiceCommand platform="iptables">-m state --state ESTABLISHED,RELATED</CustomServiceCommand>
<CustomServiceCommand platform="procurve_acl">established</CustomServiceCommand>
</CustomService>
<CustomService id="stdid14_2" name="ESTABLISHED ipv6" comment="This service matches all packets which are part of network connections established through the firewall, or connections 'related' to those established through the firewall. Term 'established' refers to the state tracking mechanism which exists inside iptables and other stateful firewalls and does not mean any particular combination of packet header options. Packet is considered to correspond to the state 'ESTABLISHED' if it belongs to the network session, for which proper initiation has been seen by the firewall, so its stateful inspection module made appropriate record in the state table. Usually stateful firewalls keep track of network connections using not only tcp protocol, but also udp and sometimes even icmp protocols. 'RELATED' describes packet belonging to a separate network connection, related to the session firewall is keeping track of. One example is FTP command and FTP data sessions." ro="False" protocol="any" address_family="ipv6">
<CustomServiceCommand platform="Undefined"/>
<CustomServiceCommand platform="Undefined"></CustomServiceCommand>
<CustomServiceCommand platform="iosacl">established</CustomServiceCommand>
<CustomServiceCommand platform="ipfilter"/>
<CustomServiceCommand platform="ipfilter"></CustomServiceCommand>
<CustomServiceCommand platform="ipfw">established</CustomServiceCommand>
<CustomServiceCommand platform="iptables">-m state --state ESTABLISHED,RELATED</CustomServiceCommand>
<CustomServiceCommand platform="procurve_acl">established</CustomServiceCommand>
@@ -372,54 +372,54 @@
</ServiceGroup>
<ServiceGroup id="stdid13" name="Custom" comment="" ro="False">
<CustomService id="id3B64EEA8" name="rpc" comment="works in iptables and requires patch-o-matic.&#10;For more information look for patch-o-matic on http://www.netfilter.org/" ro="False" protocol="any" address_family="ipv4">
<CustomServiceCommand platform="Undefined"/>
<CustomServiceCommand platform="ipf"/>
<CustomServiceCommand platform="ipfilter"/>
<CustomServiceCommand platform="ipfw"/>
<CustomServiceCommand platform="Undefined"></CustomServiceCommand>
<CustomServiceCommand platform="ipf"></CustomServiceCommand>
<CustomServiceCommand platform="ipfilter"></CustomServiceCommand>
<CustomServiceCommand platform="ipfw"></CustomServiceCommand>
<CustomServiceCommand platform="iptables">-m record_rpc</CustomServiceCommand>
<CustomServiceCommand platform="pf"/>
<CustomServiceCommand platform="pix"/>
<CustomServiceCommand platform="unknown"/>
<CustomServiceCommand platform="pf"></CustomServiceCommand>
<CustomServiceCommand platform="pix"></CustomServiceCommand>
<CustomServiceCommand platform="unknown"></CustomServiceCommand>
</CustomService>
<CustomService id="id3B64EF4E" name="irc-conn" comment="IRC connection tracker, supports DCC.&#10;Works on iptables and requires patch-o-matic.&#10;For more information look for patch-o-matic on http://www.netfilter.org/&#10;" ro="False" protocol="any" address_family="ipv4">
<CustomServiceCommand platform="Undefined"/>
<CustomServiceCommand platform="ipf"/>
<CustomServiceCommand platform="ipfilter"/>
<CustomServiceCommand platform="ipfw"/>
<CustomServiceCommand platform="Undefined"></CustomServiceCommand>
<CustomServiceCommand platform="ipf"></CustomServiceCommand>
<CustomServiceCommand platform="ipfilter"></CustomServiceCommand>
<CustomServiceCommand platform="ipfw"></CustomServiceCommand>
<CustomServiceCommand platform="iptables">-m irc</CustomServiceCommand>
<CustomServiceCommand platform="pf"/>
<CustomServiceCommand platform="pix"/>
<CustomServiceCommand platform="unknown"/>
<CustomServiceCommand platform="pf"></CustomServiceCommand>
<CustomServiceCommand platform="pix"></CustomServiceCommand>
<CustomServiceCommand platform="unknown"></CustomServiceCommand>
</CustomService>
<CustomService id="id3B64EF50" name="psd" comment="Port scan detector, works only on iptables and requires patch-o-matic &#10;For more information look for patch-o-matic on http://www.netfilter.org/" ro="False" protocol="any" address_family="ipv4">
<CustomServiceCommand platform="Undefined"/>
<CustomServiceCommand platform="ipf"/>
<CustomServiceCommand platform="ipfilter"/>
<CustomServiceCommand platform="ipfw"/>
<CustomServiceCommand platform="Undefined"></CustomServiceCommand>
<CustomServiceCommand platform="ipf"></CustomServiceCommand>
<CustomServiceCommand platform="ipfilter"></CustomServiceCommand>
<CustomServiceCommand platform="ipfw"></CustomServiceCommand>
<CustomServiceCommand platform="iptables">-m psd --psd-weight-threshold 5 --psd-delay-threshold 10000</CustomServiceCommand>
<CustomServiceCommand platform="pf"/>
<CustomServiceCommand platform="pix"/>
<CustomServiceCommand platform="unknown"/>
<CustomServiceCommand platform="pf"></CustomServiceCommand>
<CustomServiceCommand platform="pix"></CustomServiceCommand>
<CustomServiceCommand platform="unknown"></CustomServiceCommand>
</CustomService>
<CustomService id="id3B64EF52" name="string" comment="Matches a string in a whole packet, works in iptables and requires patch-o-matic.&#10;For more information look for patch-o-matic on http://www.netfilter.org/" ro="False" protocol="any" address_family="ipv4">
<CustomServiceCommand platform="Undefined"/>
<CustomServiceCommand platform="ipf"/>
<CustomServiceCommand platform="ipfilter"/>
<CustomServiceCommand platform="ipfw"/>
<CustomServiceCommand platform="Undefined"></CustomServiceCommand>
<CustomServiceCommand platform="ipf"></CustomServiceCommand>
<CustomServiceCommand platform="ipfilter"></CustomServiceCommand>
<CustomServiceCommand platform="ipfw"></CustomServiceCommand>
<CustomServiceCommand platform="iptables">-m string --string test_pattern</CustomServiceCommand>
<CustomServiceCommand platform="pf"/>
<CustomServiceCommand platform="pix"/>
<CustomServiceCommand platform="unknown"/>
<CustomServiceCommand platform="pf"></CustomServiceCommand>
<CustomServiceCommand platform="pix"></CustomServiceCommand>
<CustomServiceCommand platform="unknown"></CustomServiceCommand>
</CustomService>
<CustomService id="id3B64EF54" name="talk" comment="Talk protocol support. Works in iptables and requires patch-o-matic.&#10;For more information look for patch-o-matic on http://www.netfilter.org/" ro="False" protocol="any" address_family="ipv4">
<CustomServiceCommand platform="Undefined"/>
<CustomServiceCommand platform="ipf"/>
<CustomServiceCommand platform="ipfilter"/>
<CustomServiceCommand platform="ipfw"/>
<CustomServiceCommand platform="Undefined"></CustomServiceCommand>
<CustomServiceCommand platform="ipf"></CustomServiceCommand>
<CustomServiceCommand platform="ipfilter"></CustomServiceCommand>
<CustomServiceCommand platform="ipfw"></CustomServiceCommand>
<CustomServiceCommand platform="iptables">-m talk</CustomServiceCommand>
<CustomServiceCommand platform="pf"/>
<CustomServiceCommand platform="pix"/>
<CustomServiceCommand platform="unknown"/>
<CustomServiceCommand platform="pf"></CustomServiceCommand>
<CustomServiceCommand platform="pix"></CustomServiceCommand>
<CustomServiceCommand platform="unknown"></CustomServiceCommand>
</CustomService>
</ServiceGroup>
<ServiceGroup id="stdid19" name="TagServices" comment="" ro="False"/>