3
0

ServiceRequestJobTest.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 <AWSCoreBus.h>
  9. #include <Framework/ServiceRequestJob.h>
  10. #include <TestFramework/AWSCoreFixture.h>
  11. using namespace AWSCore;
  12. using ServiceRequestJobTest = AWSCoreFixture;
  13. #define TEST_SERVICE_REQUEST(SERVICE_NAME, METHOD, PATH) \
  14. static const char* Path() { return PATH; } \
  15. static HttpMethod Method() { return METHOD; }
  16. TEST_F(ServiceRequestJobTest, ServiceRequest_DefineFeatureGemTestServiceRequest_GetExpectedFieldValue)
  17. {
  18. class MyTestServiceRequest
  19. : public AWSCore::ServiceRequest
  20. {
  21. public:
  22. TEST_SERVICE_REQUEST(MyTestService, HttpMethod::HTTP_POST, "/test1");
  23. };
  24. MyTestServiceRequest testRequest;
  25. EXPECT_TRUE(testRequest.Method() == ServiceRequest::HttpMethod::HTTP_POST);
  26. EXPECT_TRUE(AZStd::string(testRequest.Path()) == "/test1");
  27. EXPECT_TRUE(testRequest.UseAWSCredentials());
  28. }
  29. TEST_F(ServiceRequestJobTest, ServiceRequest_DefineCustomTestServiceRequest_GetExpectedFieldValue)
  30. {
  31. class MyTestServiceRequest
  32. : public AWSCore::ServiceRequest
  33. {
  34. public:
  35. TEST_SERVICE_REQUEST(MyTestService, HttpMethod::HTTP_PUT, "/test2");
  36. };
  37. MyTestServiceRequest testRequest;
  38. EXPECT_TRUE(testRequest.Method() == ServiceRequest::HttpMethod::HTTP_PUT);
  39. EXPECT_TRUE(AZStd::string(testRequest.Path()) == "/test2");
  40. EXPECT_TRUE(testRequest.UseAWSCredentials());
  41. }