#NEWLINE# def test_perform_assignment( mocker , coordinator ) : #NEWLINE# #INDENT# member_metadata = { #NEWLINE# #INDENT# 'member-foo' : ConsumerProtocolMemberMetadata ( 0 , [ 'foo1' ] , b'' ) , #NEWLINE# 'member-bar' : ConsumerProtocolMemberMetadata ( 0 , [ 'foo1' ] , b'' ) , #NEWLINE# #UNINDENT# } #NEWLINE# assignments = { #NEWLINE# #INDENT# 'member-foo' : ConsumerProtocolMemberAssignment ( 0 , [ ( 'foo1' , [ 0 ] ) ] , b'' ) , #NEWLINE# 'member-bar' : ConsumerProtocolMemberAssignment ( 0 , [ ( 'foo1' , [ 1 ] ) ] , b'' ) , #NEWLINE# #UNINDENT# } #NEWLINE# mocker . patch . object ( RoundRobinPartitionAssignor , 'assign' ) #NEWLINE# RoundRobinPartitionAssignor . assign . return_value = assignments #NEWLINE# ret = coordinator . _perform_assignment ( 'member-foo' , 'roundrobin' , [ ( member , metadata . encode ( ) ) for ( member , metadata ) in member_metadata . items ( ) ] ) #NEWLINE# assert ( RoundRobinPartitionAssignor . assign . call_count == 1 ) #NEWLINE# RoundRobinPartitionAssignor . assign . assert_called_with ( coordinator . _client . cluster , member_metadata ) #NEWLINE# assert ( ret == assignments )