Пример #1
0
 def test_create_log_group(self, boto_session):
     session = MagicMock(['client'])
     client = MagicMock(['create_log_group', 'put_retention_policy'])
     session.client.return_value = client
     boto_session.return_value = session
     cwl = CloudWatchLogs({'lambda': {'name': 'fname', 'tags': {'createdby': 'scar'}},
                           'cloudwatch': {'log_retention_policy_in_days': 1}})
     cwl.client.client.create_log_group.return_value = "resp"
     self.assertEqual(cwl.create_log_group(), "resp")
     res = {'logGroupName': '/aws/lambda/fname', 'tags': {'createdby': 'scar'}}
     self.assertEqual(cwl.client.client.create_log_group.call_args_list[0][1], res)
Пример #2
0
 def _create_log_group(self, resources_info: Dict) -> None:
     cloudwatch_logs = CloudWatchLogs(resources_info)
     response = cloudwatch_logs.create_log_group()
     response_parser.parse_log_group_creation_response(
         response, cloudwatch_logs.get_log_group_name(),
         self.scar_info.get('cli_output'))