def test_put_code_binding_with_not_found_exception(self):
     schemas_api_caller = SchemasApiCaller(self.client)
     self.client.put_code_binding.side_effect = [
         botocore.exceptions.ClientError(
             {"Error": {"Code": "NotFoundException", "Message": "NotFoundException"}}, "operation"
         )
     ]
     with self.assertRaises(Exception):
         schemas_api_caller.put_code_binding("Java8", "aws.events", "aws.batch.BatchJobStateChange", "1")
 def test_put_code_binding_raises_not_available_in_region_exception(self):
     schemas_api_caller = SchemasApiCaller(self.client)
     self.client.put_code_binding.side_effect = botocore.exceptions.EndpointConnectionError(
         endpoint_url="Not valid endpoint.")
     with self.assertRaises(NotAvailableInRegion) as ctx:
         schemas_api_caller.put_code_binding(
             "Java8", "aws.events", "aws.batch.BatchJobStateChange", "1")
     msg = (
         "EventBridge Schemas are not available in provided region. Please check "
         "AWS doc for Schemas supported regions.")
     self.assertEqual(str(ctx.exception), msg)
 def test_put_code_binding_with_conflict_exception(self):
     schemas_api_caller = SchemasApiCaller(self.client)
     self.client.put_code_binding.side_effect = [
         botocore.exceptions.ClientError(
             {"Error": {"Code": "ConflictException", "Message": "ConflictException"}}, "operation"
         )
     ]
     schemas_api_caller.put_code_binding("Java8", "aws.events", "aws.batch.BatchJobStateChange", "1")
     self.client.put_code_binding.assert_called_once_with(
         Language="Java8", RegistryName="aws.events", SchemaName="aws.batch.BatchJobStateChange", SchemaVersion="1"
     )
Exemplo n.º 4
0
 def test_put_code_binding(self):
     schemas_api_caller = SchemasApiCaller(self.client)
     self.client.put_code_binding.return_value = {
         "Status": "CREATE_IN_PROGRESS",
         "LastModified": "2019-11-02T08:04:58Z",
         "SchemaVersion": "1",
     }
     schemas_api_caller.put_code_binding("Java8", "aws.events", "aws.batch.BatchJobStateChange", "1")
     self.client.put_code_binding.assert_called_once_with(
         Language="Java8", RegistryName="aws.events", SchemaName="aws.batch.BatchJobStateChange", SchemaVersion="1"
     )