Beispiel #1
0
        public StorageTestBase(bool async, RecordedTestMode?mode = null)
            : base(async, mode)
        {
            SanitizedQueryParameters.Add(SignatureQueryName);

#if NETFRAMEWORK
            // Uri uses different escaping for some special characters between .NET Framework and Core. Because the Test Proxy runs on .NET
            // Core, we need to normalize to the .NET Core escaping when matching and storing the recordings when running tests on NetFramework.
            UriRegexSanitizers.Add(new UriRegexSanitizer("\\(", "%28"));
            UriRegexSanitizers.Add(new UriRegexSanitizer("\\)", "%29"));
            UriRegexSanitizers.Add(new UriRegexSanitizer("\\!", "%21"));
            UriRegexSanitizers.Add(new UriRegexSanitizer("\\'", "%27"));
            UriRegexSanitizers.Add(new UriRegexSanitizer("\\*", "%2A"));
            // Encode any colons in the Uri except for the one in the scheme
            UriRegexSanitizers.Add(new UriRegexSanitizer("(?<group>:)[^//]", "%3A")
            {
                GroupForReplace = "group"
            });
#endif

            HeaderRegexSanitizers.Add(new HeaderRegexSanitizer("x-ms-encryption-key", SanitizeValue));
            HeaderRegexSanitizers.Add(new HeaderRegexSanitizer(CopySourceAuthorization, SanitizeValue));

            SanitizedQueryParametersInHeaders.Add((CopySourceName, SignatureQueryName));
            SanitizedQueryParametersInHeaders.Add((RenameSource, SignatureQueryName));
            SanitizedQueryParametersInHeaders.Add((PreviousSnapshotUrl, SignatureQueryName));
            SanitizedQueryParametersInHeaders.Add((FileRenameSource, SignatureQueryName));

            BodyRegexSanitizers.Add(new BodyRegexSanitizer(@"client_secret=(?<group>.*?)(?=&|$)", SanitizeValue)
            {
                GroupForReplace = "group"
            });

            Tenants = new TenantConfigurationBuilder(this);
        }
 public BackupRestoreTestBase(bool isAsync, KeyVaultAdministrationClientOptions.ServiceVersion serviceVersion, RecordedTestMode?mode)
     : base(isAsync, serviceVersion, mode)
 {
     JsonPathSanitizers.Add("$..token");
     SanitizedQueryParameters.Add("sig");
 }