def __init__(self, method_name): super(AppConfigurationClientTest, self).__init__(method_name) self.vcr.match_on = ["path", "method", "query"] if self.is_playback(): connection_str = "Endpoint=https://fake_app_config.azconfig-test.io;Id=0-l4-s0:h5htBaY5Z1LwFz50bIQv;Secret=bgyvBgwsQIw0s8myrqJJI3nLrj81M/kzSgSuP4BBoVg=" else: connection_str = os.getenv('APP_CONFIG_CONNECTION') app_config_client = AzureAppConfigurationClient.from_connection_string(connection_str) self.app_config_client = AzureAppConfigurationClientProxy(app_config_client)
def __init__(self, method_name): super(AppConfigurationClientTest, self).__init__(method_name) self.vcr.match_on = ["path", "method", "query"] if self.is_playback(): base_url = "https://fake_app_config.azconfig-test.io" credential = Mock(get_token=asyncio.coroutine( lambda _: AccessToken("fake-token", 0))) else: base_url = os.getenv('APP_CONFIG_ENDPOINT') credential = DefaultAzureCredential() app_config_client = AzureAppConfigurationClient(base_url=base_url, credential=credential) self.app_config_client = AzureAppConfigurationClientProxy( app_config_client)
def wrapper(*args, **kwargs): appconfiguration_connection_string = kwargs.pop( "appconfiguration_connection_string") client = AzureAppConfigurationClient.from_connection_string( appconfiguration_connection_string) client = AzureAppConfigurationClientProxy(client) kwargs['client'] = client kwargs[ 'appconfiguration_connection_string'] = appconfiguration_connection_string # Do setUp on client test_config_setting = _add_for_test( client, ConfigurationSetting( key=KEY, label=LABEL, value=TEST_VALUE, content_type=TEST_CONTENT_TYPE, tags={ "tag1": "tag1", "tag2": "tag2" }, )) test_config_setting_no_label = _add_for_test( client, ConfigurationSetting( key=KEY, label=None, value=TEST_VALUE, content_type=TEST_CONTENT_TYPE, tags={ "tag1": "tag1", "tag2": "tag2" }, )) to_delete = [test_config_setting, test_config_setting_no_label] kwargs['test_config_setting'] = test_config_setting kwargs['test_config_setting_no_label'] = test_config_setting_no_label trimmed_kwargs = {k: v for k, v in kwargs.items()} trim_kwargs_from_test_function(func, trimmed_kwargs) func(*args, **trimmed_kwargs) # do tearDown on client for item in to_delete: client.delete_configuration_setting(key=item.key, label=item.label)
def create_aad_client(self, base_url): cred = self.get_credential(AzureAppConfigurationClient, is_async=True) client = AzureAppConfigurationClient(base_url, cred) return AzureAppConfigurationClientProxy(client)