AuthenticationProviderManagerMock.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <AWSClientAuthGemMock.h>
  10. #include <Authentication/AuthenticationProviderManager.h>
  11. namespace AWSClientAuthUnitTest
  12. {
  13. class AuthenticationProviderManagerLocalMock
  14. : public AWSClientAuth::AuthenticationProviderManager
  15. {
  16. public:
  17. using AWSClientAuth::AuthenticationProviderManager::DeviceCodeGrantConfirmSignInAsync;
  18. using AWSClientAuth::AuthenticationProviderManager::DeviceCodeGrantSignInAsync;
  19. using AWSClientAuth::AuthenticationProviderManager::GetAuthenticationTokens;
  20. using AWSClientAuth::AuthenticationProviderManager::GetTokensWithRefreshAsync;
  21. using AWSClientAuth::AuthenticationProviderManager::Initialize;
  22. using AWSClientAuth::AuthenticationProviderManager::IsSignedIn;
  23. using AWSClientAuth::AuthenticationProviderManager::m_authenticationProvidersMap;
  24. using AWSClientAuth::AuthenticationProviderManager::PasswordGrantMultiFactorConfirmSignInAsync;
  25. using AWSClientAuth::AuthenticationProviderManager::PasswordGrantMultiFactorSignInAsync;
  26. using AWSClientAuth::AuthenticationProviderManager::PasswordGrantSingleFactorSignInAsync;
  27. using AWSClientAuth::AuthenticationProviderManager::RefreshTokensAsync;
  28. using AWSClientAuth::AuthenticationProviderManager::SignOut;
  29. AZStd::unique_ptr<AWSClientAuth::AuthenticationProviderInterface> CreateAuthenticationProviderObjectMock(
  30. const AWSClientAuth::ProviderNameEnum& providerName)
  31. {
  32. auto providerObject = AWSClientAuth::AuthenticationProviderManager::CreateAuthenticationProviderObject(providerName);
  33. providerObject.reset();
  34. return AZStd::make_unique<testing::NiceMock<AWSClientAuthUnitTest::AuthenticationProviderMock>>();
  35. }
  36. AuthenticationProviderManagerLocalMock()
  37. {
  38. ON_CALL(*this, CreateAuthenticationProviderObject(testing::_))
  39. .WillByDefault(testing::Invoke(this, &AuthenticationProviderManagerLocalMock::CreateAuthenticationProviderObjectMock));
  40. }
  41. MOCK_METHOD1(
  42. CreateAuthenticationProviderObject,
  43. AZStd::unique_ptr<AWSClientAuth::AuthenticationProviderInterface>(const AWSClientAuth::ProviderNameEnum&));
  44. };
  45. } // namespace AWSClientAuthUnitTest