Exemplo n.º 1
0
 def test_execute_recipes1(self):
     usage_stdout = StringIO()
     with contextlib.redirect_stdout(usage_stdout):
         modules.execute_recipes(region=region,
                                 stack=stack,
                                 cookbook=cookbook)
     output = usage_stdout.getvalue().strip()
     self.assertIn('execute_recipes main function testing', output)
Exemplo n.º 2
0
 def test_execute_recipes(self):
     with patch('boto3.client') as mock_client:
         with patch('boto3.client.create_deployment'
                    ) as boto_create_deployment:
             with patch('boto3.client.describe_instances'
                        ) as boto_describe_instances:
                 with open('test/json_data/describe_instances.json'
                           ) as json_file:
                     data = json.load(json_file)
                     boto_create_deployment.return_value = "{ 'DeploymentId': 'DEPLOYMENTID' }"
                     boto_describe_instances.return_value = data
                     modules.execute_recipes('eu-west-1',
                                             'STACKID',
                                             'COOKBOOK',
                                             custom_json='CUSTOMJSON')
                     self.assertEqual(mock_client.call_count, 3)