@ResourceGroupPreparer(location=WINDOWS_ASP_LOCATION_FUNCTIONAPP)
@StorageAccountPreparer()
def test_functionapp_slot_swap(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)])
    self.cmd('functionapp config appsettings set -g {} -n {} --slot {} --settings FOO=BAR'.format(resource_group, functionapp, slotname), checks=[JMESPathCheck("[?name=='FOO'].value|[0]", 'BAR')])
    self.cmd('functionapp deployment slot swap -g {} -n {} --slot {} --action swap'.format(resource_group, functionapp, slotname))
    self.cmd('functionapp config appsettings list -g {} -n {}'.format(resource_group, functionapp), checks=[JMESPathCheck("[?name=='FOO'].value|[0]", 'BAR')])
    self.cmd('functionapp delete -g {} -n {}'.format(resource_group, functionapp))
@ResourceGroupPreparer(location=WINDOWS_ASP_LOCATION_FUNCTIONAPP)
@StorageAccountPreparer()
def test_functionapp_slot_swap(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)])
    self.cmd('functionapp config appsettings set -g {} -n {} --slot {} --settings FOO=BAR'.format(resource_group, functionapp, slotname), checks=[JMESPathCheck("[?name=='FOO'].value|[0]", 'BAR')])
    self.cmd('functionapp deployment slot swap -g {} -n {} --slot {} --action swap'.format(resource_group, functionapp, slotname))
    self.cmd('functionapp config appsettings list -g {} -n {}'.format(resource_group, functionapp), checks=[JMESPathCheck("[?name=='FOO'].value|[0]", 'BAR')])
    self.cmd('functionapp delete -g {} -n {}'.format(resource_group, functionapp))