def __init__(self, method_name, config_file=None, recording_name=None, recording_processors=None, replay_processors=None, recording_patches=None, replay_patches=None): self.name_replacer = GeneralNameReplacer() super(ScenarioTest, self).__init__( method_name, config_file=config_file, recording_processors=recording_processors or [ SubscriptionRecordingProcessor(MOCKED_SUBSCRIPTION_ID), OAuthRequestResponsesFilter(), LargeRequestBodyProcessor(), LargeResponseBodyProcessor(), DeploymentNameReplacer(), RequestUrlNormalizer(), self.name_replacer, ], replay_processors=replay_processors or [ LargeResponseBodyReplacer(), DeploymentNameReplacer(), RequestUrlNormalizer(), ], recording_patches=recording_patches or [patch_main_exception_handler], replay_patches=replay_patches or [ patch_main_exception_handler, patch_time_sleep_api, patch_long_run_operation_delay, patch_load_cached_subscriptions, patch_retrieve_token_for_user, patch_progress_controller, ], recording_dir=find_recording_dir(inspect.getfile(self.__class__)), recording_name=recording_name )
def __init__(self, method_name, config_file=None, recording_name=None, recording_processors=None, replay_processors=None, recording_patches=None, replay_patches=None): self.cli_ctx = get_dummy_cli() self.name_replacer = GeneralNameReplacer() self.kwargs = {} self.test_guid_count = 0 default_recording_processors = [ SubscriptionRecordingProcessor(MOCKED_SUBSCRIPTION_ID), OAuthRequestResponsesFilter(), LargeRequestBodyProcessor(), LargeResponseBodyProcessor(), DeploymentNameReplacer(), RequestUrlNormalizer(), self.name_replacer, StorageAccountKeyReplacer() ] default_replay_processors = [ LargeResponseBodyReplacer(), DeploymentNameReplacer(), RequestUrlNormalizer(), ] default_recording_patches = [patch_main_exception_handler] default_replay_patches = [ patch_main_exception_handler, patch_time_sleep_api, patch_long_run_operation_delay, patch_load_cached_subscriptions, patch_retrieve_token_for_user, patch_progress_controller, ] def _merge_lists(base, patches): merged = list(base) if patches and not isinstance(patches, list): patches = [patches] if patches: merged = list(set(merged).union(set(patches))) return merged super(ScenarioTest, self).__init__( method_name, config_file=config_file, recording_processors=_merge_lists(default_recording_processors, recording_processors), replay_processors=_merge_lists(default_replay_processors, replay_processors), recording_patches=_merge_lists(default_recording_patches, recording_patches), replay_patches=_merge_lists(default_replay_patches, replay_patches), recording_dir=find_recording_dir(inspect.getfile(self.__class__)), recording_name=recording_name)
def _get_recording_processors(self): return [ self.scrubber, AuthenticationMetadataFilter(), OAuthRequestResponsesFilter(), RequestUrlNormalizer() ]
def _get_recording_processors(self): return [ self.scrubber, OAuthRequestResponsesFilter(), DeploymentNameReplacer(), RequestUrlNormalizer() ]
def _get_recording_processors(self): return [ self.scrubber, OAuthRequestResponsesFilter(), # DeploymentNameReplacer(), Not use this one, give me full control on deployment name RequestUrlNormalizer() ]
def __init__(self, *args, **kwargs): scrubber = GeneralNameReplacer() super(RecordedTestCase, self).__init__( *args, recording_processors=[RecordingRedactor(), scrubber], replay_processors=[RequestUrlNormalizer()], **kwargs) self.scrubber = scrubber self.replay_patches.append(patch_time_sleep_api) self.user_assigned_identity_client_id = os.environ.get( "USER_ASSIGNED_IDENTITY_CLIENT_ID", PLAYBACK_CLIENT_ID)
def __init__(self, *args, **kwargs): scrubber = GeneralNameReplacer() super(CaeTestCase, self).__init__( *args, recording_processors=[ RecordingRedactor(record_unique_values=True), scrubber ], replay_processors=[RequestUrlNormalizer(), IdTokenProcessor()], **kwargs) self.scrubber = scrubber if self.is_live: if "CAE_TENANT_ID" not in os.environ: pytest.skip("Missing a tenant ID for CAE tests") if "CAE_ARM_URL" not in os.environ: pytest.skip("Missing an ARM URL for CAE tests") self.cae_settings = { "arm_scope": os.environ.get("CAE_ARM_SCOPE", "https://management.azure.com/.default"), "arm_url": os.environ["CAE_ARM_URL"], "authority": os.environ.get("CAE_AUTHORITY", AzureAuthorityHosts.AZURE_PUBLIC_CLOUD), "graph_url": os.environ.get("CAE_GRAPH_URL", "https://graph.microsoft.com"), "password": os.environ.get("CAE_PASSWORD"), "tenant_id": os.environ["CAE_TENANT_ID"], "username": os.environ.get("CAE_USERNAME"), } real = urlparse(self.cae_settings["arm_url"]) self.scrubber.register_name_pair(real.netloc, "management.azure.com") self.scrubber.register_name_pair(self.cae_settings["tenant_id"], "tenant") self.scrubber.register_name_pair(self.cae_settings["username"], "username") else: self.cae_settings = { "arm_scope": "https://management.azure.com/.default", "arm_url": "https://management.azure.com/", "authority": AzureAuthorityHosts.AZURE_PUBLIC_CLOUD, "password": "******", "tenant_id": "tenant", "username": "******", } self.replay_patches.append(patch_time_sleep_api)
def __init__(self, method_name): super(ContainerRegistryTestClass, self).__init__( method_name, recording_processors=[ GeneralNameReplacer(), OAuthRequestResponsesFilterACR(), AuthenticationMetadataFilter(), RequestUrlNormalizer(), AcrBodyReplacer(), ManagementRequestReplacer(), ], ) self.repository = "library/busybox"
def __init__(self, *args, **kwargs): super(CertificateClientTests, self).__init__( *args, replay_processors=[RetryAfterReplacer(), RequestUrlNormalizer()], **kwargs)
def _get_replay_processors(self): return [RequestUrlNormalizer()]
def _get_recording_processors(self): return [self.scrubber, RequestUrlNormalizer()]