ServiceJobUtilTest.cpp 964 B

1234567891011121314151617181920212223242526
  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. #include <Framework/ServiceJobUtil.h>
  9. #include <TestFramework/AWSCoreFixture.h>
  10. using ServiceJobUtilTest = AWSCoreFixture;
  11. TEST_F(ServiceJobUtilTest, DetermineRegionFromRequestUrl_DefaultUrlFormat_Success)
  12. {
  13. Aws::String defaultUrl = "https://rest-api-id.execute-api.region1.amazonaws.com/stage/path";
  14. Aws::String region = AWSCore::DetermineRegionFromServiceUrl(defaultUrl);
  15. EXPECT_EQ(region, Aws::String("region1"));
  16. }
  17. TEST_F(ServiceJobUtilTest, DetermineRegionFromRequestUrl_CustomUrlFormat_Success)
  18. {
  19. Aws::String alternativeUrl = "https://custom_domain_name/region2.stage.rest-api-id/path";
  20. Aws::String region = AWSCore::DetermineRegionFromServiceUrl(alternativeUrl);
  21. EXPECT_EQ(region, Aws::String("region2"));
  22. }