@ResourceGroupPreparer(location=LINUX_ASP_LOCATION_WEBAPP)
def test_linux_webapp(self, resource_group):
    runtime = 'node|10.16'
    plan = self.create_random_name(prefix='webapp-linux-plan', length=24)
    webapp = self.create_random_name(prefix='webapp-linux', length=24)
    self.cmd('appservice plan create -g {} -n {} --sku S1 --is-linux'.format(resource_group, plan), checks=[JMESPathCheck('reserved', True), JMESPathCheck('sku.name', 'S1')])
    self.cmd('webapp create -g {} -n {} --plan {} --runtime {}'.format(resource_group, webapp, plan, runtime), checks=[JMESPathCheck('name', webapp)])
    self.cmd('webapp config show -g {} -n {}'.format(resource_group, webapp), checks=[JMESPathCheck('windowsFxVersion', None)])
    time.sleep(30)
    self.cmd('webapp list -g {}'.format(resource_group), checks=[JMESPathCheck('length([])', 1), JMESPathCheck('[0].name', webapp), JMESPathCheck('[0].kind', 'app,linux')])
    self.cmd('webapp show -g {} -n {}'.format(resource_group, webapp), checks=[JMESPathCheck('name', webapp), JMESPathCheck('kind', 'app,linux')])
    self.cmd('webapp config set -g {} -n {} --startup-file {}'.format(resource_group, webapp, 'process.json'), checks=[JMESPathCheck('appCommandLine', 'process.json')])
    result = self.cmd('webapp deployment container config -g {} -n {} --enable-cd true'.format(resource_group, webapp)).get_output_in_json()
    self.assertTrue(result['CI_CD_URL'].startswith('https://'))
    self.assertTrue(result['CI_CD_URL'].endswith('.scm.azurewebsites.net/docker/hook'))
    result = self.cmd('webapp config container set -g {} -n {} --docker-custom-image-name {} --docker-registry-server-password {} --docker-registry-server-user {} --docker-registry-server-url {} --enable-app-service-storage {}'.format(resource_group, webapp, 'foo-image', 'foo-password', 'foo-user', 'foo-url', 'false')).get_output_in_json()
    self.assertEqual(set((x['value'] for x in result if (x['name'] == 'DOCKER_REGISTRY_SERVER_PASSWORD'))), set([None]))
    result = self.cmd('webapp config container show -g {} -n {} '.format(resource_group, webapp)).get_output_in_json()
    self.assertEqual(set((x['name'] for x in result)), set(['DOCKER_REGISTRY_SERVER_URL', 'DOCKER_REGISTRY_SERVER_USERNAME', 'DOCKER_CUSTOM_IMAGE_NAME', 'DOCKER_REGISTRY_SERVER_PASSWORD', 'WEBSITES_ENABLE_APP_SERVICE_STORAGE']))
    self.assertEqual(set((x['value'] for x in result if (x['name'] == 'DOCKER_REGISTRY_SERVER_PASSWORD'))), set([None]))
    sample = next((x for x in result if (x['name'] == 'DOCKER_REGISTRY_SERVER_URL')))
    self.assertEqual(sample, {'name': 'DOCKER_REGISTRY_SERVER_URL', 'slotSetting': False, 'value': 'foo-url'})
    sample = next((x for x in result if (x['name'] == 'WEBSITES_ENABLE_APP_SERVICE_STORAGE')))
    self.assertEqual(sample, {'name': 'WEBSITES_ENABLE_APP_SERVICE_STORAGE', 'slotSetting': False, 'value': 'false'})
    self.cmd('webapp config container delete -g {} -n {}'.format(resource_group, webapp))
    result2 = self.cmd('webapp config container show -g {} -n {} '.format(resource_group, webapp)).get_output_in_json()
    self.assertEqual(result2, [])
@ResourceGroupPreparer(location=LINUX_ASP_LOCATION_WEBAPP)
def test_linux_webapp(self, resource_group):
    runtime = 'node|10.16'
    plan = self.create_random_name(prefix='webapp-linux-plan', length=24)
    webapp = self.create_random_name(prefix='webapp-linux', length=24)
    self.cmd('appservice plan create -g {} -n {} --sku S1 --is-linux'.format(resource_group, plan), checks=[JMESPathCheck('reserved', True), JMESPathCheck('sku.name', 'S1')])
    self.cmd('webapp create -g {} -n {} --plan {} --runtime {}'.format(resource_group, webapp, plan, runtime), checks=[JMESPathCheck('name', webapp)])
    self.cmd('webapp config show -g {} -n {}'.format(resource_group, webapp), checks=[JMESPathCheck('windowsFxVersion', None)])
    time.sleep(30)
    self.cmd('webapp list -g {}'.format(resource_group), checks=[JMESPathCheck('length([])', 1), JMESPathCheck('[0].name', webapp), JMESPathCheck('[0].kind', 'app,linux')])
    self.cmd('webapp show -g {} -n {}'.format(resource_group, webapp), checks=[JMESPathCheck('name', webapp), JMESPathCheck('kind', 'app,linux')])
    self.cmd('webapp config set -g {} -n {} --startup-file {}'.format(resource_group, webapp, 'process.json'), checks=[JMESPathCheck('appCommandLine', 'process.json')])
    result = self.cmd('webapp deployment container config -g {} -n {} --enable-cd true'.format(resource_group, webapp)).get_output_in_json()
    self.assertTrue(result['CI_CD_URL'].startswith('https://'))
    self.assertTrue(result['CI_CD_URL'].endswith('.scm.azurewebsites.net/docker/hook'))
    result = self.cmd('webapp config container set -g {} -n {} --docker-custom-image-name {} --docker-registry-server-password {} --docker-registry-server-user {} --docker-registry-server-url {} --enable-app-service-storage {}'.format(resource_group, webapp, 'foo-image', 'foo-password', 'foo-user', 'foo-url', 'false')).get_output_in_json()
    self.assertEqual(set((x['value'] for x in result if (x['name'] == 'DOCKER_REGISTRY_SERVER_PASSWORD'))), set([None]))
    result = self.cmd('webapp config container show -g {} -n {} '.format(resource_group, webapp)).get_output_in_json()
    self.assertEqual(set((x['name'] for x in result)), set(['DOCKER_REGISTRY_SERVER_URL', 'DOCKER_REGISTRY_SERVER_USERNAME', 'DOCKER_CUSTOM_IMAGE_NAME', 'DOCKER_REGISTRY_SERVER_PASSWORD', 'WEBSITES_ENABLE_APP_SERVICE_STORAGE']))
    self.assertEqual(set((x['value'] for x in result if (x['name'] == 'DOCKER_REGISTRY_SERVER_PASSWORD'))), set([None]))
    sample = next((x for x in result if (x['name'] == 'DOCKER_REGISTRY_SERVER_URL')))
    self.assertEqual(sample, {'name': 'DOCKER_REGISTRY_SERVER_URL', 'slotSetting': False, 'value': 'foo-url'})
    sample = next((x for x in result if (x['name'] == 'WEBSITES_ENABLE_APP_SERVICE_STORAGE')))
    self.assertEqual(sample, {'name': 'WEBSITES_ENABLE_APP_SERVICE_STORAGE', 'slotSetting': False, 'value': 'false'})
    self.cmd('webapp config container delete -g {} -n {}'.format(resource_group, webapp))
    result2 = self.cmd('webapp config container show -g {} -n {} '.format(resource_group, webapp)).get_output_in_json()
    self.assertEqual(result2, [])