AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Classes | Functions | Variables
alexaClientSDK::acsdkAuthorization::test Namespace Reference

Classes

class  AuthorizationManagerTest
 
class  MockAuthorizationAdapter
 Mock class implementing the adapter. More...
 
class  MockRegistrationManager
 Mock class implementing RegistrationManagerInterface. More...
 
class  StubAuthorization
 Class to implement AuthorizationInterface, which is used to retrieve the id. More...
 

Functions

 TEST_F (AuthorizationManagerTest, test_create_Succeeds)
 Test that create succeeds. More...
 
 TEST_F (AuthorizationManagerTest, test_createNullParam_Fails)
 Test that create with null param results in nullptr. More...
 
 TEST_F (AuthorizationManagerTest, test_authorizingState_DoesNotPersist)
 Test that in the AUTHORIZING state, auth and user id are not persisted. More...
 
 TEST_F (AuthorizationManagerTest, test_authorizingState_NoToken)
 Test that in the AUTHORIZING state, the getToken calls no-op. More...
 
 TEST_F (AuthorizationManagerTest, test_refreshedState_Persisted)
 Check that in the REFRESHED state, the token is now valid as well as adapter id and user id are persisted. More...
 
 TEST_F (AuthorizationManagerTest, test_unrecoverableError_Success)
 Check the behavior if AuthorizationManager is in the UNRECOVERABLE_ERROR state. More...
 
 TEST_F (AuthorizationManagerTest, test_invalidStateTransition_NoNotification)
 Check invalid transitions. More...
 
 TEST_F (AuthorizationManagerTest, test_getState)
 Check that getState returns the correct thing. More...
 
 TEST_F (AuthorizationManagerTest, test_activeAuthorization_Success)
 Check that the active authorization returns the correct id. More...
 
 TEST_F (AuthorizationManagerTest, test_logout)
 Check that logout succeeds. More...
 
 INSTANTIATE_TEST_CASE_P (Parameterized, AuthorizationManagerTest, ::testing::Values(std::pair< std::string, std::string >(ADAPTER_ID, USER_ID_2), std::pair< std::string, std::string >(ADAPTER_ID_2, USER_ID), std::pair< std::string, std::string >(ADAPTER_ID_2, USER_ID_2)))
 Parameterized Tests to test combinations of mismatched adapter and user ids. More...
 
 TEST_P (AuthorizationManagerTest, test_mismatchingIdRefreshed_AuthorizingRequest_ImplictLogout)
 Check the implict logout behavior if AuthorizationManager is in the REFRESHED state. More...
 
 TEST_P (AuthorizationManagerTest, test_mismatchingIdAuthorizing_AuthorizingRequest_ImplictLogout)
 
 TEST_P (AuthorizationManagerTest, test_mismatchingId_RefreshingRequest_Logout)
 

Variables

std::chrono::milliseconds TIMEOUT {2000}
 Timeout for test cases that require synchronization. More...
 
static const std::string ADAPTER_ID = "test-adapter"
 
static const std::string USER_ID = "test-user-id"
 
static const std::string AUTH_TOKEN = "supersecureauthotoken"
 
static const std::string ADAPTER_ID_2 = ADAPTER_ID + "2"
 
static const std::string USER_ID_2 = USER_ID + "2"
 
static const std::string AUTH_TOKEN_2 = AUTH_TOKEN + "2"
 
static const std::string MISC_TABLE_COMPONENT_NAME = "AuthorizationManager"
 
static const std::string MISC_TABLE_TABLE_NAME = "authorizationState"
 
static const std::string MISC_TABLE_ADAPTER_ID_KEY = "authAdapterId"
 
static const std::string MISC_TABLE_USER_ID_KEY = "userId"
 

Function Documentation

◆ INSTANTIATE_TEST_CASE_P()

alexaClientSDK::acsdkAuthorization::test::INSTANTIATE_TEST_CASE_P ( Parameterized  ,
AuthorizationManagerTest  ,
::testing::Values(std::pair< std::string, std::string >(ADAPTER_ID, USER_ID_2), std::pair< std::string, std::string >(ADAPTER_ID_2, USER_ID), std::pair< std::string, std::string >(ADAPTER_ID_2, USER_ID_2))   
)

Parameterized Tests to test combinations of mismatched adapter and user ids.

◆ TEST_F() [1/10]

alexaClientSDK::acsdkAuthorization::test::TEST_F ( AuthorizationManagerTest  ,
test_create_Succeeds   
)

Test that create succeeds.

◆ TEST_F() [2/10]

alexaClientSDK::acsdkAuthorization::test::TEST_F ( AuthorizationManagerTest  ,
test_createNullParam_Fails   
)

Test that create with null param results in nullptr.

◆ TEST_F() [3/10]

alexaClientSDK::acsdkAuthorization::test::TEST_F ( AuthorizationManagerTest  ,
test_authorizingState_DoesNotPersist   
)

Test that in the AUTHORIZING state, auth and user id are not persisted.

◆ TEST_F() [4/10]

alexaClientSDK::acsdkAuthorization::test::TEST_F ( AuthorizationManagerTest  ,
test_authorizingState_NoToken   
)

Test that in the AUTHORIZING state, the getToken calls no-op.

◆ TEST_F() [5/10]

alexaClientSDK::acsdkAuthorization::test::TEST_F ( AuthorizationManagerTest  ,
test_refreshedState_Persisted   
)

Check that in the REFRESHED state, the token is now valid as well as adapter id and user id are persisted.

◆ TEST_F() [6/10]

alexaClientSDK::acsdkAuthorization::test::TEST_F ( AuthorizationManagerTest  ,
test_unrecoverableError_Success   
)

Check the behavior if AuthorizationManager is in the UNRECOVERABLE_ERROR state.

◆ TEST_F() [7/10]

alexaClientSDK::acsdkAuthorization::test::TEST_F ( AuthorizationManagerTest  ,
test_invalidStateTransition_NoNotification   
)

Check invalid transitions.

◆ TEST_F() [8/10]

alexaClientSDK::acsdkAuthorization::test::TEST_F ( AuthorizationManagerTest  ,
test_getState   
)

Check that getState returns the correct thing.

◆ TEST_F() [9/10]

alexaClientSDK::acsdkAuthorization::test::TEST_F ( AuthorizationManagerTest  ,
test_activeAuthorization_Success   
)

Check that the active authorization returns the correct id.

◆ TEST_F() [10/10]

alexaClientSDK::acsdkAuthorization::test::TEST_F ( AuthorizationManagerTest  ,
test_logout   
)

Check that logout succeeds.

◆ TEST_P() [1/3]

alexaClientSDK::acsdkAuthorization::test::TEST_P ( AuthorizationManagerTest  ,
test_mismatchingIdRefreshed_AuthorizingRequest_ImplictLogout   
)

Check the implict logout behavior if AuthorizationManager is in the REFRESHED state.

◆ TEST_P() [2/3]

alexaClientSDK::acsdkAuthorization::test::TEST_P ( AuthorizationManagerTest  ,
test_mismatchingIdAuthorizing_AuthorizingRequest_ImplictLogout   
)

The new adapter will be allow to continue authorizing while we reset the current adapter and logout the rest of the device.

◆ TEST_P() [3/3]

alexaClientSDK::acsdkAuthorization::test::TEST_P ( AuthorizationManagerTest  ,
test_mismatchingId_RefreshingRequest_Logout   
)

Another adapter has reported it is in REFRESHED state, meaning we have multiple authorizations. To protect customer data, force a logout, and reset all authorizations.

Variable Documentation

◆ ADAPTER_ID

const std::string alexaClientSDK::acsdkAuthorization::test::ADAPTER_ID = "test-adapter"
static

Adapter Related Constants

◆ ADAPTER_ID_2

const std::string alexaClientSDK::acsdkAuthorization::test::ADAPTER_ID_2 = ADAPTER_ID + "2"
static

Adapter Related Constants

◆ AUTH_TOKEN

const std::string alexaClientSDK::acsdkAuthorization::test::AUTH_TOKEN = "supersecureauthotoken"
static

Adapter Related Constants

◆ AUTH_TOKEN_2

const std::string alexaClientSDK::acsdkAuthorization::test::AUTH_TOKEN_2 = AUTH_TOKEN + "2"
static

Adapter Related Constants

◆ MISC_TABLE_ADAPTER_ID_KEY

const std::string alexaClientSDK::acsdkAuthorization::test::MISC_TABLE_ADAPTER_ID_KEY = "authAdapterId"
static

Storage Constants

◆ MISC_TABLE_COMPONENT_NAME

const std::string alexaClientSDK::acsdkAuthorization::test::MISC_TABLE_COMPONENT_NAME = "AuthorizationManager"
static

Storage Constants

◆ MISC_TABLE_TABLE_NAME

const std::string alexaClientSDK::acsdkAuthorization::test::MISC_TABLE_TABLE_NAME = "authorizationState"
static

Storage Constants

◆ MISC_TABLE_USER_ID_KEY

const std::string alexaClientSDK::acsdkAuthorization::test::MISC_TABLE_USER_ID_KEY = "userId"
static

Storage Constants

◆ TIMEOUT

std::chrono::milliseconds alexaClientSDK::acsdkAuthorization::test::TIMEOUT {2000}

Timeout for test cases that require synchronization.

◆ USER_ID

const std::string alexaClientSDK::acsdkAuthorization::test::USER_ID = "test-user-id"
static

Adapter Related Constants

◆ USER_ID_2

const std::string alexaClientSDK::acsdkAuthorization::test::USER_ID_2 = USER_ID + "2"
static

Adapter Related Constants

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