Skip to content

Commit a4883b6

Browse files
author
Chris Townsend
committed
test: Add scope_guard to reset proxy when test finishes
1 parent f7245b6 commit a4883b6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/test_daemon.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,11 @@
4747
#include <gtest/gtest.h>
4848

4949
#include <QCoreApplication>
50+
#include <QNetworkProxyFactory>
5051
#include <QSysInfo>
5152

53+
#include <scope_guard.hpp>
54+
5255
#include <memory>
5356
#include <ostream>
5457
#include <sstream>
@@ -370,6 +373,11 @@ TEST_F(Daemon, failed_restart_command_returns_fulfilled_promise)
370373

371374
TEST_F(Daemon, proxy_contains_valid_info)
372375
{
376+
auto guard = sg::make_scope_guard([] {
377+
// Resets proxy back to what the system is configured for
378+
QNetworkProxyFactory::setUseSystemConfiguration(true);
379+
});
380+
373381
QString username{"username"};
374382
QString password{"password"};
375383
QString hostname{"192.168.1.1"};

0 commit comments

Comments
 (0)