2022-09-15 09:33:04 -04:00
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
2023-03-01 15:59:42 -05:00
/*
* Test types are indicated by the test label ending.
*
* _1_ Requires credentials, permissions, and AWS resources.
* _2_ Requires credentials and permissions.
* _3_ Does not require credentials.
*
*/
2022-09-15 09:33:04 -04:00
# include <gtest/gtest.h>
# include <fstream>
2024-07-03 09:52:38 -04:00
# include "../s3_examples.h"
2022-09-15 09:33:04 -04:00
# include <aws/core/utils/UUID.h>
# include "S3_GTests.h"
static const int BUCKETS_NEEDED = 1 ;
namespace AwsDocTest {
// NOLINTNEXTLINE(readability-named-parameter)
2023-03-01 15:59:42 -05:00
TEST_F ( S3_GTests , delete_objects_2_ ) {
2022-09-15 09:33:04 -04:00
std : : vector < Aws : : String > bucketNames = GetCachedS3Buckets ( BUCKETS_NEEDED ) ;
2023-01-19 13:06:31 -05:00
ASSERT_GE ( bucketNames . size ( ) , BUCKETS_NEEDED )
< < " Failed to meet precondition " < < std : : endl ;
2022-09-15 09:33:04 -04:00
2023-01-19 13:06:31 -05:00
const Aws : : Vector < Aws : : String > objectKeys = { " test1_key " , " test2_key " ,
" test3_key " } ;
2024-07-03 09:52:38 -04:00
for ( auto & objectKey : objectKeys ) {
Aws : : String fileName = PutTestFileInBucket ( bucketNames [ 0 ] , objectKey ) ;
ASSERT_TRUE ( ! fileName . empty ( ) ) < < " Failed to meet precondition " < < std : : endl ;
}
2023-01-19 13:06:31 -05:00
2024-07-03 09:52:38 -04:00
bool result = AwsDoc : : S3 : : deleteObjects ( objectKeys , bucketNames [ 0 ] , * s_clientConfig ) ;
ASSERT_TRUE ( result ) ;
}
2022-09-15 09:33:04 -04:00
} // namespace AwsDocTest