@@ -737,14 +737,34 @@ def test_sink_create_ok(self):
737737 api .sink_create (
738738 self .PROJECT , self .SINK_NAME , self .FILTER , self .DESTINATION_URI )
739739
740- parent , sink , options = (
740+ parent , sink , options , unique_writer_identity = (
741741 gax_api ._create_sink_called_with )
742742 self .assertEqual (parent , self .PROJECT_PATH )
743743 self .assertIsInstance (sink , LogSink )
744744 self .assertEqual (sink .name , self .SINK_NAME )
745745 self .assertEqual (sink .filter , self .FILTER )
746746 self .assertEqual (sink .destination , self .DESTINATION_URI )
747747 self .assertIsNone (options )
748+ self .assertFalse (unique_writer_identity )
749+
750+ def test_sink_create_with_unique_writer_identity (self ):
751+ from google .cloud .proto .logging .v2 .logging_config_pb2 import LogSink
752+
753+ gax_api = _GAXSinksAPI ()
754+ api = self ._make_one (gax_api , None )
755+ api .sink_create (
756+ self .PROJECT , self .SINK_NAME , self .FILTER , self .DESTINATION_URI ,
757+ unique_writer_identity = True ,
758+ )
759+ parent , sink , options , unique_writer_identity = (
760+ gax_api ._create_sink_called_with )
761+ self .assertEqual (parent , self .PROJECT_PATH )
762+ self .assertIsInstance (sink , LogSink )
763+ self .assertEqual (sink .name , self .SINK_NAME )
764+ self .assertEqual (sink .filter , self .FILTER )
765+ self .assertEqual (sink .destination , self .DESTINATION_URI )
766+ self .assertIsNone (options )
767+ self .assertTrue (unique_writer_identity )
748768
749769 def test_sink_get_error (self ):
750770 from google .cloud .exceptions import NotFound
@@ -1462,10 +1482,10 @@ def list_sinks(self, parent, page_size, options):
14621482 self ._list_sinks_called_with = parent , page_size , options
14631483 return self ._list_sinks_response
14641484
1465- def create_sink (self , parent , sink , options ):
1485+ def create_sink (self , parent , sink , options , unique_writer_identity = False ):
14661486 from google .gax .errors import GaxError
14671487
1468- self ._create_sink_called_with = parent , sink , options
1488+ self ._create_sink_called_with = parent , sink , options , unique_writer_identity
14691489 if self ._random_gax_error :
14701490 raise GaxError ('error' )
14711491 if self ._create_sink_conflict :
0 commit comments