@AllowLargeResponse()
@ResourceGroupPreparer(name_prefix='cli_test_webapp_config_appsettings', location=WINDOWS_ASP_LOCATION_WEBAPP)
def test_webapp_config_appsettings(self, resource_group):
    webapp_name = self.create_random_name('webapp-config-appsettings-test', 40)
    plan_name = self.create_random_name('webapp-config-appsettings-plan', 40)
    self.cmd('appservice plan create -g {} -n {} --sku S1'.format(resource_group, plan_name))
    self.cmd('webapp create -g {} -n {} --plan {}'.format(resource_group, webapp_name, plan_name))
    self.cmd('webapp config appsettings set -g {} -n {} --settings s1=foo s2=bar s3=bar2'.format(resource_group, webapp_name)).assert_with_checks([JMESPathCheck("length([?name=='s1'])", 1), JMESPathCheck("length([?name=='s2'])", 1), JMESPathCheck("length([?name=='s3'])", 1), JMESPathCheck("length([?value=='foo'])", 1), JMESPathCheck("length([?value=='bar'])", 1), JMESPathCheck("length([?value=='bar2'])", 1)])
    result = self.cmd('webapp config appsettings list -g {} -n {}'.format(resource_group, webapp_name)).get_output_in_json()
    s2 = next((x for x in result if (x['name'] == 's2')))
    self.assertEqual(s2['name'], 's2')
    self.assertEqual(s2['slotSetting'], False)
    self.assertEqual(s2['value'], 'bar')
    self.assertEqual(set([x['name'] for x in result]), set(['s1', 's2', 's3', 'WEBSITE_NODE_DEFAULT_VERSION']))
    self.cmd('webapp create -g {} -n {} --plan {}'.format(resource_group, webapp_name, plan_name))
    result = self.cmd('webapp config appsettings list -g {} -n {}'.format(resource_group, webapp_name)).get_output_in_json()
    s2 = next((x for x in result if (x['name'] == 's2')))
    self.assertEqual(s2['name'], 's2')
    self.assertEqual(s2['slotSetting'], False)
    self.assertEqual(s2['value'], 'bar')
    self.assertEqual(set([x['name'] for x in result]), set(['s1', 's2', 's3', 'WEBSITE_NODE_DEFAULT_VERSION']))
@AllowLargeResponse()
@ResourceGroupPreparer(name_prefix='cli_test_webapp_config_appsettings', location=WINDOWS_ASP_LOCATION_WEBAPP)
def test_webapp_config_appsettings(self, resource_group):
    webapp_name = self.create_random_name('webapp-config-appsettings-test', 40)
    plan_name = self.create_random_name('webapp-config-appsettings-plan', 40)
    self.cmd('appservice plan create -g {} -n {} --sku S1'.format(resource_group, plan_name))
    self.cmd('webapp create -g {} -n {} --plan {}'.format(resource_group, webapp_name, plan_name))
    self.cmd('webapp config appsettings set -g {} -n {} --settings s1=foo s2=bar s3=bar2'.format(resource_group, webapp_name)).assert_with_checks([JMESPathCheck("length([?name=='s1'])", 1), JMESPathCheck("length([?name=='s2'])", 1), JMESPathCheck("length([?name=='s3'])", 1), JMESPathCheck("length([?value=='foo'])", 1), JMESPathCheck("length([?value=='bar'])", 1), JMESPathCheck("length([?value=='bar2'])", 1)])
    result = self.cmd('webapp config appsettings list -g {} -n {}'.format(resource_group, webapp_name)).get_output_in_json()
    s2 = next((x for x in result if (x['name'] == 's2')))
    self.assertEqual(s2['name'], 's2')
    self.assertEqual(s2['slotSetting'], False)
    self.assertEqual(s2['value'], 'bar')
    self.assertEqual(set([x['name'] for x in result]), set(['s1', 's2', 's3', 'WEBSITE_NODE_DEFAULT_VERSION']))
    self.cmd('webapp create -g {} -n {} --plan {}'.format(resource_group, webapp_name, plan_name))
    result = self.cmd('webapp config appsettings list -g {} -n {}'.format(resource_group, webapp_name)).get_output_in_json()
    s2 = next((x for x in result if (x['name'] == 's2')))
    self.assertEqual(s2['name'], 's2')
    self.assertEqual(s2['slotSetting'], False)
    self.assertEqual(s2['value'], 'bar')
    self.assertEqual(set([x['name'] for x in result]), set(['s1', 's2', 's3', 'WEBSITE_NODE_DEFAULT_VERSION']))