Skip to content

Commit

Permalink
[tests] Check set handler throws if unauthorized.
Browse files Browse the repository at this point in the history
  • Loading branch information
luis4a0 committed Feb 14, 2024
1 parent 52c34bf commit 603f4c0
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tests/test_daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include "tracking_url_downloader.h"

#include <src/daemon/default_vm_image_vault.h>
#include <src/daemon/instance_settings_handler.h>

#include <multipass/constants.h>
#include <multipass/default_vm_blueprint_provider.h>
Expand Down Expand Up @@ -2126,10 +2127,16 @@ TEST_P(DaemonSetExceptions, setHandlesSettingsException)
}

INSTANTIATE_TEST_SUITE_P(
Daemon, DaemonSetExceptions,
Values(std::tuple{mp::UnrecognizedSettingException{"foo"}, grpc::StatusCode::INVALID_ARGUMENT,
Daemon,
DaemonSetExceptions,
Values(std::tuple{mp::NonAuthorizedBridgeSettingsException{"reason", "instance", "eth8"},
grpc::StatusCode::INTERNAL,
HasSubstr("Need user authorization to bridge eth8")},
std::tuple{mp::UnrecognizedSettingException{"foo"},
grpc::StatusCode::INVALID_ARGUMENT,
AllOf(HasSubstr("Unrecognized"), HasSubstr("foo"))},
std::tuple{mp::InvalidSettingException{"foo", "bar", "err"}, grpc::StatusCode::INVALID_ARGUMENT,
std::tuple{mp::InvalidSettingException{"foo", "bar", "err"},
grpc::StatusCode::INVALID_ARGUMENT,
AllOf(HasSubstr("Invalid"), HasSubstr("foo"), HasSubstr("bar"), HasSubstr("err"))},
std::tuple{std::runtime_error{"Other"}, grpc::StatusCode::INTERNAL, HasSubstr("Other")}));

Expand Down

0 comments on commit 603f4c0

Please sign in to comment.