@@ -1625,6 +1625,20 @@ Y_UNIT_TEST_SUITE(TestHttpProxy) {
1625
1625
UNIT_ASSERT_VALUES_EQUAL (resultMessage, " The specified queue doesn't exist." );
1626
1626
}
1627
1627
1628
+ Y_UNIT_TEST_F (TestGetQueueUrlWithIAM, THttpProxyTestMock) {
1629
+ auto req = CreateSqsGetQueueUrlRequest ();
1630
+ req[" QueueName" ] = " not-existing-queue" ;
1631
+ auto res = SendHttpRequest (" /Root?folderId=XXX" , " AmazonSQS.GetQueueUrl" , std::move (req), " X-YaCloud-SubjectToken: Bearer proxy_sa@builtin" );
1632
+ UNIT_ASSERT_VALUES_EQUAL (res.HttpCode , 400 );
1633
+
1634
+ NJson::TJsonValue json;
1635
+ UNIT_ASSERT (NJson::ReadJsonTree (res.Body , &json));
1636
+ TString resultType = GetByPath<TString>(json, " __type" );
1637
+ UNIT_ASSERT_VALUES_EQUAL (resultType, " AWS.SimpleQueueService.NonExistentQueue" );
1638
+ TString resultMessage = GetByPath<TString>(json, " message" );
1639
+ UNIT_ASSERT_VALUES_EQUAL (resultMessage, " The specified queue doesn't exist." );
1640
+ }
1641
+
1628
1642
Y_UNIT_TEST_F (TestSendMessage, THttpProxyTestMock) {
1629
1643
auto createQueueReq = CreateSqsCreateQueueRequest ();
1630
1644
auto res = SendHttpRequest (" /Root" , " AmazonSQS.CreateQueue" , std::move (createQueueReq), FormAuthorizationStr (" ru-central1" ));
@@ -1645,7 +1659,7 @@ Y_UNIT_TEST_SUITE(TestHttpProxy) {
1645
1659
UNIT_ASSERT_VALUES_EQUAL (res.HttpCode , 200 );
1646
1660
UNIT_ASSERT (NJson::ReadJsonTree (res.Body , &json));
1647
1661
UNIT_ASSERT (!GetByPath<TString>(json, " SequenceNumber" ).empty ());
1648
- UNIT_ASSERT (!GetByPath<TString>(json, " Md5OfMessageBody " ).empty ());
1662
+ UNIT_ASSERT (!GetByPath<TString>(json, " MD5OfMessageBody " ).empty ());
1649
1663
UNIT_ASSERT (!GetByPath<TString>(json, " MessageId" ).empty ());
1650
1664
}
1651
1665
@@ -1666,7 +1680,7 @@ Y_UNIT_TEST_SUITE(TestHttpProxy) {
1666
1680
1667
1681
res = SendHttpRequest (" /Root" , " AmazonSQS.SendMessage" , std::move (sendMessageReq), FormAuthorizationStr (" ru-central1" ));
1668
1682
UNIT_ASSERT (NJson::ReadJsonTree (res.Body , &json));
1669
- UNIT_ASSERT (!GetByPath<TString>(json, " Md5OfMessageBody " ).empty ());
1683
+ UNIT_ASSERT (!GetByPath<TString>(json, " MD5OfMessageBody " ).empty ());
1670
1684
UNIT_ASSERT_VALUES_EQUAL (res.HttpCode , 200 );
1671
1685
1672
1686
for (int i = 0 ; i < 20 ; ++i) {
@@ -1698,16 +1712,58 @@ Y_UNIT_TEST_SUITE(TestHttpProxy) {
1698
1712
TString resultQueueUrl = GetByPath<TString>(json, " QueueUrl" );
1699
1713
UNIT_ASSERT (resultQueueUrl.EndsWith (" ExampleQueueName" ));
1700
1714
1701
- NJson::TJsonValue getQueueAttributes;
1702
- getQueueAttributes[" QueueUrl" ] = resultQueueUrl;
1703
- NJson::TJsonArray attributeNames = {" DelaySeconds" };
1704
- getQueueAttributes[" AttributeNames" ] = attributeNames;
1715
+ {
1716
+ NJson::TJsonValue getQueueAttributes;
1717
+ getQueueAttributes[" QueueUrl" ] = resultQueueUrl;
1718
+ NJson::TJsonArray attributeNames = {" DelaySeconds" };
1719
+ getQueueAttributes[" AttributeNames" ] = attributeNames;
1705
1720
1706
- res = SendHttpRequest (" /Root" , " AmazonSQS.GetQueueAttributes" , std::move (getQueueAttributes), FormAuthorizationStr (" ru-central1" ));
1707
- UNIT_ASSERT_VALUES_EQUAL (res.HttpCode , 200 );
1708
- NJson::TJsonValue resultJson;
1709
- UNIT_ASSERT (NJson::ReadJsonTree (res.Body , &resultJson));
1710
- UNIT_ASSERT_VALUES_EQUAL (resultJson[" Attributes" ][" DelaySeconds" ], " 1" );
1721
+ res = SendHttpRequest (" /Root" , " AmazonSQS.GetQueueAttributes" , std::move (getQueueAttributes), FormAuthorizationStr (" ru-central1" ));
1722
+ UNIT_ASSERT_VALUES_EQUAL (res.HttpCode , 200 );
1723
+ NJson::TJsonValue resultJson;
1724
+ UNIT_ASSERT (NJson::ReadJsonTree (res.Body , &resultJson));
1725
+ UNIT_ASSERT_VALUES_EQUAL (resultJson[" Attributes" ][" DelaySeconds" ], " 1" );
1726
+ }
1727
+
1728
+ {
1729
+ NJson::TJsonValue getQueueAttributes;
1730
+ getQueueAttributes[" QueueUrl" ] = resultQueueUrl;
1731
+ NJson::TJsonArray attributeNames = {
1732
+ " ApproximateNumberOfMessages" ,
1733
+ " ApproximateNumberOfMessagesDelayed" ,
1734
+ " ApproximateNumberOfMessagesNotVisible" ,
1735
+ " CreatedTimestamp" ,
1736
+ " DelaySeconds" ,
1737
+ " MaximumMessageSize" ,
1738
+ " MessageRetentionPeriod" ,
1739
+ " ReceiveMessageWaitTimeSeconds" ,
1740
+ " RedrivePolicy" ,
1741
+ " VisibilityTimeout" ,
1742
+ " FifoQueue" ,
1743
+ " ContentBasedDeduplication" ,
1744
+ " QueueArn"
1745
+ };
1746
+ getQueueAttributes[" AttributeNames" ] = attributeNames;
1747
+
1748
+ res = SendHttpRequest (" /Root" , " AmazonSQS.GetQueueAttributes" , std::move (getQueueAttributes), FormAuthorizationStr (" ru-central1" ));
1749
+ UNIT_ASSERT_VALUES_EQUAL (res.HttpCode , 200 );
1750
+ NJson::TJsonValue resultJson;
1751
+ UNIT_ASSERT (NJson::ReadJsonTree (res.Body , &resultJson));
1752
+ UNIT_ASSERT_VALUES_EQUAL (resultJson[" Attributes" ][" DelaySeconds" ], " 1" );
1753
+ }
1754
+
1755
+ {
1756
+ NJson::TJsonValue getQueueAttributes;
1757
+ getQueueAttributes[" QueueUrl" ] = resultQueueUrl;
1758
+ NJson::TJsonArray attributeNames = {" All" };
1759
+ getQueueAttributes[" AttributeNames" ] = attributeNames;
1760
+
1761
+ res = SendHttpRequest (" /Root" , " AmazonSQS.GetQueueAttributes" , std::move (getQueueAttributes), FormAuthorizationStr (" ru-central1" ));
1762
+ UNIT_ASSERT_VALUES_EQUAL (res.HttpCode , 200 );
1763
+ NJson::TJsonValue resultJson;
1764
+ UNIT_ASSERT (NJson::ReadJsonTree (res.Body , &resultJson));
1765
+ UNIT_ASSERT_VALUES_EQUAL (resultJson[" Attributes" ][" DelaySeconds" ], " 1" );
1766
+ }
1711
1767
}
1712
1768
1713
1769
Y_UNIT_TEST_F (TestListQueues, THttpProxyTestMock) {
@@ -1911,8 +1967,8 @@ Y_UNIT_TEST_SUITE(TestHttpProxy) {
1911
1967
UNIT_ASSERT (json[" Successful" ].GetArray ().size () == 2 );
1912
1968
auto succesful0 = json[" Successful" ][0 ];
1913
1969
UNIT_ASSERT (succesful0[" Id" ] == " Id-0" );
1914
- UNIT_ASSERT (!GetByPath<TString>(succesful0, " Md5OfMessageAttributes " ).empty ());
1915
- UNIT_ASSERT (!GetByPath<TString>(succesful0, " Md5OfMessageBody " ).empty ());
1970
+ UNIT_ASSERT (!GetByPath<TString>(succesful0, " MD5OfMessageAttributes " ).empty ());
1971
+ UNIT_ASSERT (!GetByPath<TString>(succesful0, " MD5OfMessageBody " ).empty ());
1916
1972
UNIT_ASSERT (!GetByPath<TString>(succesful0, " MessageId" ).empty ());
1917
1973
}
1918
1974
0 commit comments