@ResourceGroupPreparer(location=WINDOWS_ASP_LOCATION_FUNCTIONAPP)
@StorageAccountPreparer()
def test_functionapp_slot_creation(self, resource_group, storage_account):
    plan = self.create_random_name(prefix='funcappplan', length=24)
    functionapp = self.create_random_name(prefix='functionapp-slot', length=24)
    slotname = self.create_random_name(prefix='slotname', length=24)
    self.cmd('functionapp plan create -g {} -n {} --sku S1'.format(resource_group, plan), checks=[JMESPathCheck('sku.name', 'S1')])
    self.cmd('functionapp create -g {} -n {} --plan {} -s {} --runtime node'.format(resource_group, functionapp, plan, storage_account), checks=[JMESPathCheck('name', functionapp)])
    self.cmd('functionapp deployment slot create -g {} -n {} --slot {}'.format(resource_group, functionapp, slotname), checks=[JMESPathCheck('name', slotname), JMESPathCheck('type', 'Microsoft.Web/sites/slots')])
    pre_slot_list = self.cmd('functionapp deployment slot list -g {} -n {}'.format(resource_group, functionapp), checks=[JMESPathCheck("[?name=='{}'].type|[0]".format(slotname), 'Microsoft.Web/sites/slots')]).get_output_in_json()
    self.assertEqual(len(pre_slot_list), 1)
    self.cmd('functionapp deployment slot delete -g {} -n {} --slot {}'.format(resource_group, functionapp, slotname))
    deleted_slot_list = self.cmd('functionapp deployment slot list -g {} -n {}'.format(resource_group, functionapp)).get_output_in_json()
    self.assertEqual(len(deleted_slot_list), 0)
    self.cmd('functionapp delete -g {} -n {}'.format(resource_group, functionapp))
@ResourceGroupPreparer(location=WINDOWS_ASP_LOCATION_FUNCTIONAPP)
@StorageAccountPreparer()
def test_functionapp_slot_creation(self, resource_group, storage_account):
    plan = self.create_random_name(prefix='funcappplan', length=24)
    functionapp = self.create_random_name(prefix='functionapp-slot', length=24)
    slotname = self.create_random_name(prefix='slotname', length=24)
    self.cmd('functionapp plan create -g {} -n {} --sku S1'.format(resource_group, plan), checks=[JMESPathCheck('sku.name', 'S1')])
    self.cmd('functionapp create -g {} -n {} --plan {} -s {} --runtime node'.format(resource_group, functionapp, plan, storage_account), checks=[JMESPathCheck('name', functionapp)])
    self.cmd('functionapp deployment slot create -g {} -n {} --slot {}'.format(resource_group, functionapp, slotname), checks=[JMESPathCheck('name', slotname), JMESPathCheck('type', 'Microsoft.Web/sites/slots')])
    pre_slot_list = self.cmd('functionapp deployment slot list -g {} -n {}'.format(resource_group, functionapp), checks=[JMESPathCheck("[?name=='{}'].type|[0]".format(slotname), 'Microsoft.Web/sites/slots')]).get_output_in_json()
    self.assertEqual(len(pre_slot_list), 1)
    self.cmd('functionapp deployment slot delete -g {} -n {} --slot {}'.format(resource_group, functionapp, slotname))
    deleted_slot_list = self.cmd('functionapp deployment slot list -g {} -n {}'.format(resource_group, functionapp)).get_output_in_json()
    self.assertEqual(len(deleted_slot_list), 0)
    self.cmd('functionapp delete -g {} -n {}'.format(resource_group, functionapp))