Skip to content

Commit f7245b6

Browse files
author
Chris Townsend
committed
tests: Add network proxy setup test
1 parent eee45fd commit f7245b6

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/test_daemon.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <multipass/vm_image_host.h>
3131
#include <multipass/vm_image_vault.h>
3232

33+
#include "mock_environment_helpers.h"
3334
#include "mock_virtual_machine_factory.h"
3435
#include "stub_cert_store.h"
3536
#include "stub_certprovider.h"
@@ -367,6 +368,23 @@ TEST_F(Daemon, failed_restart_command_returns_fulfilled_promise)
367368
EXPECT_TRUE(is_ready(status_promise.get_future()));
368369
}
369370

371+
TEST_F(Daemon, proxy_contains_valid_info)
372+
{
373+
QString username{"username"};
374+
QString password{"password"};
375+
QString hostname{"192.168.1.1"};
376+
qint16 port{3128};
377+
QString proxy = QString("%1:%2@%3:%4").arg(username).arg(password).arg(hostname).arg(port);
378+
379+
mpt::SetEnvScope env("http_proxy", proxy.toUtf8());
380+
381+
auto config = config_builder.build();
382+
383+
EXPECT_THAT(config->network_proxy->user(), username);
384+
EXPECT_THAT(config->network_proxy->password(), password);
385+
EXPECT_THAT(config->network_proxy->hostName(), hostname);
386+
EXPECT_THAT(config->network_proxy->port(), port);
387+
}
370388

371389
namespace
372390
{

0 commit comments

Comments
 (0)