AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Classes | Namespaces | Functions | Variables
LWAAuthorizationAdapterTest.cpp File Reference
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <functional>
#include <acsdkAuthorization/LWA/LWAAuthorizationAdapter.h>
#include <acsdkAuthorizationInterfaces/LWA/CBLAuthorizationObserverInterface.h>
#include <acsdkAuthorizationInterfaces/LWA/LWAAuthorizationStorageInterface.h>
#include <acsdkAuthorization/LWA/LWAAuthorizationConfiguration.h>
#include <AVSCommon/Utils/Configuration/ConfigurationNode.h>
#include <AVSCommon/Utils/DeviceInfo.h>
#include <AVSCommon/Utils/HTTP/HttpResponseCode.h>
#include <AVSCommon/Utils/LibcurlUtils/HTTPResponse.h>
#include <AVSCommon/Utils/LibcurlUtils/MockHttpGet.h>
#include <AVSCommon/Utils/LibcurlUtils/MockHttpPost.h>
#include <AVSCommon/Utils/WaitEvent.h>
#include <AVSCommon/Utils/Optional.h>
#include <acsdkAuthorization/LWA/test/StubStorage.h>
Include dependency graph for LWAAuthorizationAdapterTest.cpp:

Classes

class  alexaClientSDK::acsdkAuthorization::lwa::test::MockCBLObserver
 A mock observer. More...
 
class  alexaClientSDK::acsdkAuthorization::lwa::test::MockAuthManager
 A mock AuthorizationManager. More...
 
class  alexaClientSDK::acsdkAuthorization::lwa::test::LWAAuthorizationAdapterTest
 

Namespaces

 alexaClientSDK
 Whether or not curl logs should be emitted.
 
 alexaClientSDK::acsdkAuthorization
 
 alexaClientSDK::acsdkAuthorization::lwa
 
 alexaClientSDK::acsdkAuthorization::lwa::test
 

Functions

 alexaClientSDK::acsdkAuthorization::lwa::test::TEST_F (LWAAuthorizationAdapterTest, test_create_NullParams_Nullptr)
 Test create with null ptr. More...
 
 alexaClientSDK::acsdkAuthorization::lwa::test::TEST_F (LWAAuthorizationAdapterTest, test_id_DefaultValue)
 Check the default value for the adapter id both directly and via getAuthorizationInterface. More...
 
 alexaClientSDK::acsdkAuthorization::lwa::test::TEST_F (LWAAuthorizationAdapterTest, test_getAuthTokenNoAuth_Fails)
 Check that no token is returned when not authorized. More...
 
 alexaClientSDK::acsdkAuthorization::lwa::test::TEST_F (LWAAuthorizationAdapterTest, test_id_CustomValue)
 Check the custom value for the adapter id both directly and via getAuthorizationInterface. More...
 
 alexaClientSDK::acsdkAuthorization::lwa::test::TEST_F (LWAAuthorizationAdapterTest, test_authorize_NoAuthMgr_Fails)
 Check that authorizing without an AuthManager fails. More...
 
 alexaClientSDK::acsdkAuthorization::lwa::test::TEST_F (LWAAuthorizationAdapterTest, test_multipleCBLAuthorization_Fails)
 Check that multiple authorization requests fail. Only one reportStateChange call for each state is expected. More...
 
 alexaClientSDK::acsdkAuthorization::lwa::test::TEST_F (LWAAuthorizationAdapterTest, test_cblCodePairRetry_Succeeds)
 Check that the retry logic for CBL code pair requests is successful. More...
 
 alexaClientSDK::acsdkAuthorization::lwa::test::TEST_F (LWAAuthorizationAdapterTest, test_cblTokenExchangeRetry_Succeeds)
 Check that the retry logic for CBL token exchange requests is successful. More...
 
 alexaClientSDK::acsdkAuthorization::lwa::test::TEST_F (LWAAuthorizationAdapterTest, test_authFailure_TriggersRetry)
 Check that on auth failure, a retry is triggered. More...
 
 alexaClientSDK::acsdkAuthorization::lwa::test::TEST_F (LWAAuthorizationAdapterTest, test_getState_Succeeds)
 Check that getState returns the correct state. More...
 
 alexaClientSDK::acsdkAuthorization::lwa::test::TEST_F (LWAAuthorizationAdapterTest, test_reset_Succeeds)
 Check that reset operations are successful. More...
 
 alexaClientSDK::acsdkAuthorization::lwa::test::TEST_F (LWAAuthorizationAdapterTest, test_refreshing_succeeds)
 Check that the LWA token refreshing logic is successful. More...
 
 alexaClientSDK::acsdkAuthorization::lwa::test::TEST_F (LWAAuthorizationAdapterTest, test_reset_CodePair)
 Test resetting while waiting for code pair requests. More...
 
 alexaClientSDK::acsdkAuthorization::lwa::test::TEST_F (LWAAuthorizationAdapterTest, test_reset_TokenExchange)
 Test resetting while waiting for token exchange requests. More...
 
 alexaClientSDK::acsdkAuthorization::lwa::test::INSTANTIATE_TEST_CASE_P (Parameterized, LWAAuthorizationAdapterTest, ::testing::Values(AUTHORIZE_USING_CBL, AUTHORIZE_USING_CBL_WITH_CUSTOMER_PROFILE))
 Parameterized Tests Exercising both authorizeUsingCBL and authorizeUsingCBLWithCustomerProfile. More...
 
 alexaClientSDK::acsdkAuthorization::lwa::test::TEST_P (LWAAuthorizationAdapterTest, test_cblAuthorize_Succeeds)
 Test that the happy case succeeds. More...
 
 alexaClientSDK::acsdkAuthorization::lwa::test::TEST_P (LWAAuthorizationAdapterTest, test_cblAuthorize_CorrectScopes)
 Check that authorizeUsingCBL<WithCustomerProfile> is requesting with the correct scopes. More...
 

Variables

static const std::string alexaClientSDK::acsdkAuthorization::lwa::test::USER_ID = "test-user-id"
 An example user id that would be returned by the Customer Profile API. More...
 
static const std::string alexaClientSDK::acsdkAuthorization::lwa::test::NAME = "Test User"
 An example name that would be returned by the Customer Profile API. More...
 
static const std::string alexaClientSDK::acsdkAuthorization::lwa::test::EMAIL = "test@user.com"
 An example email that would be returned by the Customer Profile API. More...
 
static const std::string alexaClientSDK::acsdkAuthorization::lwa::test::VERIFICATION_URI = "https://amazon.com/us/code"
 The Veritifcation URI. More...
 
static const std::string alexaClientSDK::acsdkAuthorization::lwa::test::USER_CODE = "ABCDE"
 An example CBL code to be returned from CBL auth. More...
 
static const std::string alexaClientSDK::acsdkAuthorization::lwa::test::DEVICE_CODE = "deviceCode"
 An example device code to be returned from CBL auth. More...
 
static const std::string alexaClientSDK::acsdkAuthorization::lwa::test::ADAPTER_ID = "test-adapter-id"
 A test adapter id. More...
 
const std::string alexaClientSDK::acsdkAuthorization::lwa::test::DEFAULT_ADAPTER_ID = "lwa-adapter"
 Default adapter id. More...
 
std::chrono::seconds alexaClientSDK::acsdkAuthorization::lwa::test::TIMEOUT {2}
 Timeout for test cases that require synchronization. More...
 
std::chrono::seconds alexaClientSDK::acsdkAuthorization::lwa::test::LONG_TIMEOUT {20}
 Long timeout for cases involving waiting for retries. More...
 
static const std::string alexaClientSDK::acsdkAuthorization::lwa::test::CONFIG_ROOT_NODE = "lwaAuthorization"
 The config node for the LWAAuthorizationAdapter. More...
 
static const std::string alexaClientSDK::acsdkAuthorization::lwa::test::AUTHORIZE_USING_CBL = "authorizeUsingCBL"
 The method name for authorizeUsingCBL. More...
 
static const std::string alexaClientSDK::acsdkAuthorization::lwa::test::AUTHORIZE_USING_CBL_WITH_CUSTOMER_PROFILE = "authorizeUsingCBLWithCustomerProfile"
 The method name for authorizeUsingCBLWithCustomerProfile. More...
 
const std::string alexaClientSDK::acsdkAuthorization::lwa::test::EXPIRATION_S = "3600"
 Example responses from LWA. More...
 
const std::string alexaClientSDK::acsdkAuthorization::lwa::test::INTERVAL_S = "3600"
 
const std::string alexaClientSDK::acsdkAuthorization::lwa::test::ACCESS_TOKEN = "myaccesstoken"
 
const std::string alexaClientSDK::acsdkAuthorization::lwa::test::REFRESH_TOKEN = "myrefreshtoken"
 
const std::string alexaClientSDK::acsdkAuthorization::lwa::test::TOKEN_TYPE = "bearer"
 
const std::string alexaClientSDK::acsdkAuthorization::lwa::test::EXPIRATION = "3600"
 
static const std::string alexaClientSDK::acsdkAuthorization::lwa::test::CONFIG_JSON
 The Config JSON. More...
 
static const HTTPResponse alexaClientSDK::acsdkAuthorization::lwa::test::CODE_PAIR_RESPONSE
 A default successful code pair response. More...
 
static const HTTPResponse alexaClientSDK::acsdkAuthorization::lwa::test::TOKEN_EXCHANGE_RESPONSE
 A default successful token exchange response. More...
 
static const HTTPResponse alexaClientSDK::acsdkAuthorization::lwa::test::CUSTOMER_PROFILE_SHORT_RESPONSE
 A defauilt successful customer profile response containing only the user id. More...
 
static const HTTPResponse alexaClientSDK::acsdkAuthorization::lwa::test::CUSTOMER_PROFILE_RESPONSE
 A defauilt successful customer profile response. More...
 

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0