

def test_absent_when_nuke_api_and_no_more_stages_deployments_remain(self):
    '\n        Tests scenario where the stagename exists and there are no stages associated with same deployment,\n        the api would be deleted.\n        '
    self.conn.get_rest_apis.return_value = apis_ret
    self.conn.get_stage.return_value = stage1_deployment1_ret
    self.conn.delete_stage.return_value = {
        'ResponseMetadata': {
            'HTTPStatusCode': 200,
            'RequestId': '2d31072c-9d15-11e5-9977-6d9fcfda9c0a',
        },
    }
    self.conn.get_stages.return_value = no_stages_ret
    self.conn.get_deployments.return_value = deployments_ret
    self.conn.delete_rest_api.return_value = {
        'ResponseMetadata': {
            'HTTPStatusCode': 200,
            'RequestId': '2d31072c-9d15-11e5-9977-6d9fcfda9c0a',
        },
    }
    result = salt_states['boto_apigateway.absent']('api present', 'unit test api', 'test', nuke_api=True, **conn_parameters)
    self.assertIs(result.get('result'), True)
    self.assertIsNot(result.get('abort'), True)
    self.assertIs(result.get('changes', {
        
    }).get('new', [{
        
    }])[0].get('delete_api', {
        
    }).get('deleted'), True)

dataset/ETHPy150Open saltstack/salt/tests/unit/states/boto_apigateway_test.py BotoApiGatewayTestCase.test_absent_when_nuke_api_and_no_more_stages_deployments_remain/original