Ejemplo n.º 1
0
 public AnomalyDetectorRecordedTestSanitizer()
     : base()
 {
     AddJsonPathSanitizer("$..accessToken");
     AddJsonPathSanitizer("$..source");
     SanitizedHeaders.Add(Constants.AuthorizationHeader);
 }
Ejemplo n.º 2
0
 public DocumentTranslationRecordedTestSanitizer()
     : base()
 {
     JsonPathSanitizers.Add("$..sourceUrl");
     JsonPathSanitizers.Add("$..targetUrl");
     SanitizedHeaders.Add(Constants.AuthorizationHeader);
 }
 public PhoneNumbersClientLiveTestBase(bool isAsync) : base(isAsync)
 {
     SanitizedHeaders.Add("location");
     BodyRegexSanitizers.Add(new BodyRegexSanitizer(PhoneNumberRegEx, SanitizeValue));
     UriRegexSanitizers.Add(new UriRegexSanitizer(UrlEncodedPhoneNumberRegEx, SanitizeValue));
     SanitizedHeaders.Add("x-ms-content-sha256");
 }
Ejemplo n.º 4
0
 public FormRecognizerRecordedTestSanitizer()
     : base()
 {
     JsonPathSanitizers.Add("$..accessToken");
     JsonPathSanitizers.Add("$..source");
     SanitizedHeaders.Add(Constants.AuthorizationHeader);
 }
 public IdentityRecordedTestSanitizer()
 {
     SanitizedHeaders.Add("secret");
     AddJsonPathSanitizer("$..refresh_token");
     AddJsonPathSanitizer("$..access_token");
     BodyRegexSanitizers.Add(new BodyRegexSanitizer(@"=[^&|}|""]+", "=" + SanitizeValue)
     {
         Condition = new Condition {
             UriRegex = ".*/token([?].*)?$"
         }
     });
     HeaderTransforms.Add(new HeaderTransform(
                              "WWW-Authenticate",
                              $"Basic realm={Path.Combine(TestContext.CurrentContext.TestDirectory, "Data", "mock-arc-mi-key.key")}")
     {
         Condition = new Condition
         {
             ResponseHeader = new HeaderCondition
             {
                 Key        = "WWW-Authenticate",
                 ValueRegex = "Basic realm=.*"
             }
         }
     });
 }
 public DocumentAnalysisRecordedTestSanitizer()
     : base()
 {
     AddJsonPathSanitizer("$..accessToken");
     AddJsonPathSanitizer("$..containerUrl");
     SanitizedHeaders.Add(Constants.AuthorizationHeader);
 }
Ejemplo n.º 7
0
 public FormRecognizerLiveTestBase(bool isAsync, FormRecognizerClientOptions.ServiceVersion serviceVersion)
     : base(isAsync)
 {
     _serviceVersion = serviceVersion;
     JsonPathSanitizers.Add("$..accessToken");
     JsonPathSanitizers.Add("$..source");
     SanitizedHeaders.Add(Constants.AuthorizationHeader);
 }
 public SmsClientLiveTestBase(bool isAsync) : base(isAsync)
 {
     JsonPathSanitizers.Add("$..from");
     JsonPathSanitizers.Add("$..to");
     JsonPathSanitizers.Add("$..repeatabilityRequestId");
     JsonPathSanitizers.Add("$..repeatabilityFirstSent");
     SanitizedHeaders.Add("x-ms-content-sha256");
 }
 public DocumentAnalysisLiveTestBase(bool isAsync, DocumentAnalysisClientOptions.ServiceVersion serviceVersion)
     : base(isAsync)
 {
     _serviceVersion = serviceVersion;
     JsonPathSanitizers.Add("$..accessToken");
     JsonPathSanitizers.Add("$..containerUrl");
     SanitizedHeaders.Add(Constants.AuthorizationHeader);
 }
 public PersonalizerRecordedTestSanitizer() : base()
 {
     AddJsonPathSanitizer("$..accessToken");
     AddJsonPathSanitizer("$..source");
     SanitizedHeaders.Add("Ocp-Apim-Subscription-Key");
     // TODO: Remove when re-recording
     LegacyConvertJsonDateTokens = true;
 }
 public TablesRecordedTestSanitizer()
 {
     SanitizedHeaders.Add("My-Custom-Auth-Header");
     UriRegexSanitizers.Add(new UriRegexSanitizer(@"([\x0026|&|?]sig=)(?<group>[\w\d%]+)", SanitizeValue)
     {
         GroupForReplace = "group"
     });
 }
Ejemplo n.º 12
0
 public AnomalyDetectorLiveTestBase(bool isAsync) : base(isAsync)
 {
     {
         JsonPathSanitizers.Add("$..accessToken");
         JsonPathSanitizers.Add("$..source");
         SanitizedHeaders.Add(Constants.AuthorizationHeader);
     };
 }
 public DocumentTranslationLiveTestBase(bool isAsync, RecordedTestMode?mode = null)
     : base(isAsync, mode)
 {
     JsonPathSanitizers.Add("$..sourceUrl");
     JsonPathSanitizers.Add("$..targetUrl");
     JsonPathSanitizers.Add("$..glossaryUrl");
     SanitizedHeaders.Add(Constants.AuthorizationHeader);
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Creates a new SearchTestBase instance.
 /// </summary>
 /// <param name="async">
 /// When false, we'll rewrite our tests methods to call the sync
 /// versions of async APIs.
 /// </param>
 /// <param name="serviceVersion">
 /// Version of the REST API to test against.
 /// </param>
 /// <param name="mode">
 /// Whether to run in Playback, Record, or Live mode.  The default
 /// value is pulled from the AZURE_TEST_MODE environment variable.
 /// </param>
 public SearchTestBase(bool async, SearchClientOptions.ServiceVersion serviceVersion, RecordedTestMode?mode = null)
     : base(async, mode)
 {
     ServiceVersion = serviceVersion;
     JsonPathSanitizers.Add("$..applicationSecret");
     SanitizedHeaders.Add("api-key");
     CompareBodies = false;
 }
Ejemplo n.º 15
0
 public PersonalizerTestBase(bool isAsync) : base(isAsync)
 {
     // TODO: Compare bodies again when https://github.com/Azure/azure-sdk-for-net/issues/22219 is resolved.
     JsonPathSanitizers.Add("$..accessToken");
     JsonPathSanitizers.Add("$..source");
     SanitizedHeaders.Add("Ocp-Apim-Subscription-Key");
     CompareBodies = false;
 }
Ejemplo n.º 16
0
        protected ConversationAnalysisTestBase(bool isAsync, ConversationAnalysisClientOptions.ServiceVersion serviceVersion, RecordedTestMode?mode)
            : base(isAsync, mode)
        {
            // TODO: Compare bodies again when https://github.com/Azure/azure-sdk-for-net/issues/22219 is resolved.
            CompareBodies = false;

            SanitizedHeaders.Add("Ocp-Apim-Subscription-Key");
            ServiceVersion = serviceVersion;
        }
Ejemplo n.º 17
0
        protected QuestionAnsweringTestBase(bool isAsync, QuestionAnsweringClientOptions.ServiceVersion serviceVersion, RecordedTestMode?mode)
            : base(isAsync, mode)
        {
            // TODO: Compare bodies again when https://github.com/Azure/azure-sdk-for-net/issues/22219 is resolved.
            CompareBodies = false;

            SanitizedHeaders.Add(QuestionAnsweringClient.AuthorizationHeader);
            ServiceVersion = serviceVersion;
        }
Ejemplo n.º 18
0
 public MetricsAdvisorRecordedTestSanitizer()
 {
     SanitizedHeaders.Add(Constants.SubscriptionAuthorizationHeader);
     SanitizedHeaders.Add(Constants.ApiAuthorizationHeader);
     JsonPathSanitizers.Add("$..connectionString");
     JsonPathSanitizers.Add("$..apiKey");
     JsonPathSanitizers.Add("$..accountKey");
     JsonPathSanitizers.Add("$..authHeader");
     JsonPathSanitizers.Add("$..httpHeader");
 }
Ejemplo n.º 19
0
 public CommunicationIdentityClientLiveTestBase(bool isAsync) : base(isAsync)
 {
     JsonPathSanitizers.Add("$..token");
     JsonPathSanitizers.Add("$..appId");
     JsonPathSanitizers.Add("$..userId");
     JsonPathSanitizers.Add("$..id");
     SanitizedHeaders.Add("x-ms-content-sha256");
     UriRegexSanitizers.Add(new UriRegexSanitizer(URIIdentityReplacerRegEx, "/identities/Sanitized"));
     UriRegexSanitizers.Add(new UriRegexSanitizer(URIDomainNameReplacerRegEx, "https://sanitized.communication.azure.com"));
 }
 public TableServiceLiveTestsBase(bool isAsync, TableEndpointType endpointType, RecordedTestMode?recordedTestMode = default) : base(isAsync, recordedTestMode)
 {
     _endpointType = endpointType;
     SanitizedHeaders.Add("My-Custom-Auth-Header");
     UriRegexSanitizers.Add(
         new UriRegexSanitizer(@"([\x0026|&|?]sig=)(?<group>[\w\d%]+)", SanitizeValue)
     {
         GroupForReplace = "group"
     });
 }
Ejemplo n.º 21
0
 public FormRecognizerLiveTestBase(bool isAsync, FormRecognizerClientOptions.ServiceVersion serviceVersion)
     : base(isAsync)
 {
     _serviceVersion = serviceVersion;
     JsonPathSanitizers.Add("$..accessToken");
     JsonPathSanitizers.Add("$..containerUrl");
     SanitizedHeaders.Add(Constants.AuthorizationHeader);
     // temporary until https://github.com/Azure/azure-sdk-for-net/issues/27688 is addressed
     CompareBodies = false;
 }
Ejemplo n.º 22
0
 public MetricsAdvisorRecordedTestSanitizer()
 {
     SanitizedHeaders.Add(Constants.SubscriptionAuthorizationHeader);
     SanitizedHeaders.Add(Constants.ApiAuthorizationHeader);
     AddJsonPathSanitizer("$..connectionString");
     AddJsonPathSanitizer("$..apiKey");
     AddJsonPathSanitizer("$..accountKey");
     AddJsonPathSanitizer("$..authHeader");
     AddJsonPathSanitizer("$..httpHeader");
     // TODO: Remove when re-recording
     LegacyConvertJsonDateTokens = true;
 }
 public MetricsAdvisorLiveTestBase(bool isAsync, RecordedTestMode?mode = default) : base(isAsync, mode)
 {
     SanitizedHeaders.Add(Constants.SubscriptionAuthorizationHeader);
     SanitizedHeaders.Add(Constants.ApiAuthorizationHeader);
     JsonPathSanitizers.Add("$..password");
     JsonPathSanitizers.Add("$..certificatePassword");
     JsonPathSanitizers.Add("$..clientSecret");
     JsonPathSanitizers.Add("$..keyVaultClientSecret");
     JsonPathSanitizers.Add("$..apiKey");
     JsonPathSanitizers.Add("$..accountKey");
     JsonPathSanitizers.Add("$..authHeader");
     JsonPathSanitizers.Add("$..httpHeader");
     BodyRegexSanitizers.Add(new BodyRegexSanitizer(@"\[email protected]", "*****@*****.**"));
 }
Ejemplo n.º 24
0
 public MetricsAdvisorRecordedTestSanitizer()
 {
     SanitizedHeaders.Add(Constants.SubscriptionAuthorizationHeader);
     SanitizedHeaders.Add(Constants.ApiAuthorizationHeader);
     AddJsonPathSanitizer("$..password");
     AddJsonPathSanitizer("$..certificatePassword");
     AddJsonPathSanitizer("$..clientSecret");
     AddJsonPathSanitizer("$..keyVaultClientSecret");
     AddJsonPathSanitizer("$..apiKey");
     AddJsonPathSanitizer("$..accountKey");
     AddJsonPathSanitizer("$..authHeader");
     AddJsonPathSanitizer("$..httpHeader");
     BodyRegexSanitizers.Add(new BodyRegexSanitizer(@"\[email protected]", "*****@*****.**"));
 }
 public MetricsAdvisorRecordedTestSanitizer()
 {
     SanitizedHeaders.Add(Constants.SubscriptionAuthorizationHeader);
     SanitizedHeaders.Add(Constants.ApiAuthorizationHeader);
     AddJsonPathSanitizer("$..password");
     AddJsonPathSanitizer("$..certificatePassword");
     AddJsonPathSanitizer("$..clientSecret");
     AddJsonPathSanitizer("$..keyVaultClientSecret");
     AddJsonPathSanitizer("$..apiKey");
     AddJsonPathSanitizer("$..accountKey");
     AddJsonPathSanitizer("$..authHeader");
     AddJsonPathSanitizer("$..httpHeader");
     // TODO: Remove when re-recording
     LegacyConvertJsonDateTokens = true;
 }
Ejemplo n.º 26
0
 public ServiceBusRecordedTestSanitizer()
 {
     SanitizedHeaders.Add("ServiceBusDlqSupplementaryAuthorization");
     SanitizedHeaders.Add("ServiceBusSupplementaryAuthorization");
     BodyRegexSanitizers.Add(
         new BodyRegexSanitizer(
             "\\u003CPrimaryKey\\u003E.*\\u003C/PrimaryKey\\u003E",
             $"\u003CPrimaryKey\u003E{SanitizedKeyValue}\u003C/PrimaryKey\u003E"));
     BodyRegexSanitizers.Add(
         new BodyRegexSanitizer(
             "\\u003CSecondaryKey\\u003E.*\\u003C/SecondaryKey\\u003E",
             $"\u003CSecondaryKey\u003E{SanitizedKeyValue}\u003C/SecondaryKey\u003E"));
     BodyRegexSanitizers.Add(
         new BodyRegexSanitizer(
             "[^\\r](?<break>\\n)",
             "\r\n")
     {
         GroupForReplace = "break"
     });
 }
Ejemplo n.º 27
0
 private void InitializeRecordingSettings()
 {
     // the following headers are added by MSAL and need to be excluded from matching for recordings
     LegacyExcludedHeaders.Add("Content-Length");
     LegacyExcludedHeaders.Add("client-request-id");
     LegacyExcludedHeaders.Add("x-client-OS");
     LegacyExcludedHeaders.Add("x-client-SKU");
     LegacyExcludedHeaders.Add("x-client-CPU");
     LegacyExcludedHeaders.Add("x-client-Ver");
     // x-ms-PKeyAuth is only added on MAC and Linux so recordings made on windows will fail on these platforms and vice-versa
     // ignoring this header as CI must run on all platforms
     LegacyExcludedHeaders.Add("x-ms-PKeyAuth");
     LegacyExcludedHeaders.Add("x-client-current-telemetry");
     LegacyExcludedHeaders.Add("x-client-last-telemetry");
     LegacyExcludedHeaders.Add("x-anchormailbox");
     // temporary until update to disable cookies in Core is shipped
     LegacyExcludedHeaders.Add("cookie");
     SanitizedHeaders.Add("secret");
     JsonPathSanitizers.Add("$..refresh_token");
     JsonPathSanitizers.Add("$..access_token");
     BodyRegexSanitizers.Add(new BodyRegexSanitizer(@"=[^&|}|""]+", "=" + SanitizeValue)
     {
         Condition = new Condition {
             UriRegex = ".*/token([?].*)?$"
         }
     });
     HeaderTransforms.Add(new HeaderTransform(
                              "WWW-Authenticate",
                              $"Basic realm={Path.Combine(TestContext.CurrentContext.TestDirectory, "Data", "mock-arc-mi-key.key")}")
     {
         Condition = new Condition
         {
             ResponseHeader = new HeaderCondition
             {
                 Key        = "WWW-Authenticate",
                 ValueRegex = "Basic realm=.*"
             }
         }
     });
 }
Ejemplo n.º 28
0
 public ServiceLinkerTestBase(bool isAsync) : base(isAsync)
 {
     SanitizedHeaders.Add(UserTokenPolicy.UserTokenHeader);
 }
Ejemplo n.º 29
0
 public ServiceLinkerTestBase(bool isAsync, RecordedTestMode mode) : base(isAsync, mode)
 {
     SanitizedHeaders.Add(UserTokenPolicy.UserTokenHeader);
 }
Ejemplo n.º 30
0
 public TextAnalyticsRecordedTestSanitizer()
 {
     SanitizedHeaders.Add("Ocp-Apim-Subscription-Key");
 }