Skip to content

Commit 66486a1

Browse files
peterrsonggdscpinheiro
authored andcommitted
Add integ test for PutBucketLogging
1 parent b3139e2 commit 66486a1

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License").
5+
* You may not use this file except in compliance with the License.
6+
* A copy of the License is located at
7+
*
8+
* http://aws.amazon.com/apache2.0
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed
11+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
* express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
16+
17+
using Microsoft.VisualStudio.TestTools.UnitTesting;
18+
using Amazon.S3;
19+
using Amazon.S3.Model;
20+
using Amazon.S3.Util;
21+
using System;
22+
using System.Collections.Generic;
23+
using System.Linq;
24+
using System.Text;
25+
using System.Threading.Tasks;
26+
27+
namespace AWSSDK_DotNet.IntegrationTests.Tests.S3
28+
{
29+
[TestClass]
30+
public class PutBucketLoggingTests : TestBase<AmazonS3Client>
31+
{
32+
public static string bucketName;
33+
34+
[TestInitialize]
35+
public void Init()
36+
{
37+
bucketName = S3TestUtils.CreateBucketWithWait(Client, true);
38+
}
39+
40+
[TestCleanup]
41+
public void Cleanup()
42+
{
43+
AmazonS3Util.DeleteS3BucketWithObjects(Client, bucketName);
44+
}
45+
46+
[TestMethod]
47+
public void TestPutBucketLogging()
48+
{
49+
S3Grant grant = new S3Grant
50+
{
51+
Grantee = new S3Grantee() { URI = "http://acs.amazonaws.com/groups/s3/LogDelivery" },
52+
Permission = S3Permission.READ
53+
};
54+
List<S3Grant> grantList = new List<S3Grant>();
55+
grantList.Add(grant);
56+
var putBucketLoggingRequest = new PutBucketLoggingRequest
57+
{
58+
BucketName = bucketName,
59+
LoggingConfig = new S3BucketLoggingConfig
60+
{
61+
TargetBucketName = bucketName,
62+
Grants = grantList
63+
}
64+
};
65+
var response = Client.PutBucketLogging(putBucketLoggingRequest);
66+
Assert.IsNotNull(response);
67+
}
68+
}
69+
}

0 commit comments

Comments
 (0)