From 414dfffb41a33b392f2cc74df392a612e821addd Mon Sep 17 00:00:00 2001 From: "Scott Beddall (from Dev Box)" Date: Mon, 22 Apr 2024 16:07:08 -0700 Subject: [PATCH] fix the tests. ensure that Location gets a valid sub value --- .../Azure.Sdk.Tools.TestProxy.Tests/LoggingTests.cs | 2 +- .../Azure.Sdk.Tools.TestProxy.Tests/RecordingHandlerTests.cs | 4 ++-- .../Azure.Sdk.Tools.TestProxy/Common/SanitizerDictionary.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/LoggingTests.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/LoggingTests.cs index 6295230326e..ce7e7b4f0e6 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/LoggingTests.cs +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/LoggingTests.cs @@ -116,7 +116,7 @@ private static void AssertLogs(TestLogger logger, int offset, int expectedLength Assert.Equal( "Request Body Content{\"key\":\"Location\",\"value\":\"https://fakeazsdktestaccount.table.core.windows.net/Tables\"}", logger.Logs[2 + offset].ToString()); - Assert.Equal("URI: [ https://fakeazsdktestaccount.table.core.windows.net/Tables]" + + Assert.Equal("URI: [ https://REDACTED.table.core.windows.net/Tables]" + Environment.NewLine + "Headers: [{\"Accept\":[\"application/json;odata=minimalmetadata\"],\"Accept-Encoding\":[\"gzip, deflate\"],\"Authorization\":[\"Sanitized\"],\"Connection\":[\"keep-alive\"]," + "\"Content-Length\":[\"" + expectedContentLength + "\"],\"Content-Type\":[\"application/octet-stream\"],\"DataServiceVersion\":[\"3.0\"],\"Date\":[\"Tue, 18 May 2021 23:27:42 GMT\"]," + "\"User-Agent\":[\"azsdk-python-data-tables/12.0.0b7 Python/3.8.6 (Windows-10-10.0.19041-SP0)\"],\"x-ms-client-request-id\":[\"Sanitized\"]," + diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/RecordingHandlerTests.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/RecordingHandlerTests.cs index c77199a31e4..5f0048e0ef5 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/RecordingHandlerTests.cs +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy.Tests/RecordingHandlerTests.cs @@ -308,7 +308,7 @@ public async Task TestLoadOfAbsoluteRecording() var playbackSession = recordingHandler.PlaybackSessions.First(); var entry = playbackSession.Value.Session.Entries.First(); - Assert.Equal("https://login.microsoftonline.com/12345678-1234-1234-1234-123456789012/oauth2/v2.0/token", entry.RequestUri); + Assert.Equal("https://REDACTED.microsoftonline.com/12345678-1234-1234-1234-123456789012/oauth2/v2.0/token", entry.RequestUri); } [Fact] @@ -324,7 +324,7 @@ public async Task TestLoadOfRelativeRecording() var playbackSession = recordingHandler.PlaybackSessions.First(); var entry = playbackSession.Value.Session.Entries.First(); - Assert.Equal("https://login.microsoftonline.com/12345678-1234-1234-1234-123456789012/oauth2/v2.0/token", entry.RequestUri); + Assert.Equal("https://REDACTED.microsoftonline.com/12345678-1234-1234-1234-123456789012/oauth2/v2.0/token", entry.RequestUri); } [Fact] diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/SanitizerDictionary.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/SanitizerDictionary.cs index 1b3d03bca2f..3df60d257ec 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/SanitizerDictionary.cs +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/SanitizerDictionary.cs @@ -205,7 +205,7 @@ public SanitizerDictionary() { ), // new BodyKeySanitizer("$..resourceLocation"), disabled, not a secret? new RegisteredSanitizer( - new HeaderRegexSanitizer("Location"), + new HeaderRegexSanitizer("Location", value: "example.com"), "AZSDK038" ), new RegisteredSanitizer(