Skip to content

Commit 3f33474

Browse files
authored
Add Track2 CosmosDB Sanitizer (Azure#23759)
1 parent bc86b4a commit 3f33474

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

sdk/cosmosdb/Azure.ResourceManager.CosmosDB/tests/CosmosDBManagementClientBase.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public abstract class CosmosDBManagementClientBase : ManagementRecordedTestBase<
1818
protected CosmosDBManagementClientBase(bool isAsync)
1919
: base(isAsync)
2020
{
21+
Sanitizer = new CosmosDBManagementRecordedTestSanitizer();
2122
}
2223

2324
protected void InitializeClients()
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
using Azure.Core.TestFramework;
5+
using Castle.Core.Internal;
6+
7+
namespace Azure.ResourceManager.CosmosDB.Tests
8+
{
9+
public class CosmosDBManagementRecordedTestSanitizer : RecordedTestSanitizer
10+
{
11+
public CosmosDBManagementRecordedTestSanitizer() : base()
12+
{
13+
// Lazy sanitize fields in the request and response bodies
14+
AddJsonPathSanitizer("$..primaryMasterKey");
15+
AddJsonPathSanitizer("$..primaryReadonlyMasterKey");
16+
AddJsonPathSanitizer("$..secondaryMasterKey");
17+
AddJsonPathSanitizer("$..secondaryReadonlyMasterKey");
18+
}
19+
}
20+
}

0 commit comments

Comments
 (0)