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, OAuthRequestResponsesFilter(), LargeRequestBodyProcessor(max_request_body=10), # DeploymentNameReplacer(), Not use this one, give me full control on deployment name RequestUrlNormalizer() ]