15 #include <gtest/gtest.h> 16 #include <gmock/gmock.h> 23 #include <aws/core/config/AWSProfileConfigLoader.h> 24 #include <aws/core/Aws.h> 25 #include <aws/core/utils/logging/LogMacros.h> 26 #include <aws/core/utils/logging/AWSLogging.h> 27 #include <aws/core/utils/logging/LogLevel.h> 40 TEST(ParameterTest, LoadLexParamsUserIdFail) {
42 SetupMockReader(AwsError::AWS_ERR_NOT_FOUND, AwsError::AWS_ERR_OK, AwsError::AWS_ERR_OK,
48 TEST(ParameterTest, LoadLexParamsBotNameFail) {
50 SetupMockReader(AwsError::AWS_ERR_OK, AwsError::AWS_ERR_NOT_FOUND, AwsError::AWS_ERR_OK,
56 TEST(ParameterTest, LoadLexParamsBotAliasFail) {
58 SetupMockReader(AwsError::AWS_ERR_OK, AwsError::AWS_ERR_OK, AwsError::AWS_ERR_NOT_FOUND,
67 TEST(ParameterTest, LoadLexParamsSuccess) {
69 const std::string user_id =
"user_id";
70 const std::string bot_name =
"bot_name";
71 const std::string bot_alias =
"bot_alias";
76 return AwsError::AWS_ERR_OK;
78 using namespace std::placeholders;
79 using testing::Invoke;
81 .WillOnce(Invoke(std::bind(read_std_str, user_id, _1, _2)));
83 .WillOnce(Invoke(std::bind(read_std_str, bot_name, _1, _2)));
85 .WillOnce(Invoke(std::bind(read_std_str, bot_alias, _1, _2)));
88 EXPECT_EQ(user_id, lex_config.
user_id);
89 EXPECT_EQ(bot_name, lex_config.
bot_name);
90 EXPECT_EQ(bot_alias, lex_config.
bot_alias);
93 int main(
int argc,
char ** argv)
95 Aws::Utils::Logging::InitializeAWSLogging(
96 std::make_shared<Aws::Utils::Logging::TestLogSystem>(Aws::Utils::Logging::LogLevel::Trace));
97 Aws::SDKOptions options;
98 Aws::InitAPI(options);
101 ::testing::InitGoogleMock(&argc, argv);
102 auto result = RUN_ALL_TESTS();
103 Aws::Utils::Logging::ShutdownAWSLogging();
104 Aws::ShutdownAPI(options);
int main(int argc, char **argv)
void SetupMockReader(AwsError user_id_error, AwsError bot_name_error, AwsError bot_alias_error, ParameterReaderMock &mock_reader)
TEST(ParameterTest, LoadLexParamsUserIdFail)
const ParameterPath bot_alias_key
const ParameterPath user_id_key
const ParameterPath bot_name_key
ErrorCode LoadLexParameters(const Client::ParameterReaderInterface ¶meter_interface, LexConfiguration &lex_configuration)