#NEWLINE# @ mock . patch ( 'sahara.plugins.ambari.client.context' ) #NEWLINE# def test_wait_ambari_request( self , mock_context ) : #NEWLINE# #INDENT# client = ambari_client . AmbariClient ( self . instance ) #NEWLINE# check_mock = mock . MagicMock ( ) #NEWLINE# d1 = { #NEWLINE# #INDENT# 'request_context' : 'r1' , #NEWLINE# 'request_status' : 'PENDING' , #NEWLINE# 'progress_percent' : 42 , #NEWLINE# #UNINDENT# } #NEWLINE# d2 = { #NEWLINE# #INDENT# 'request_context' : 'r1' , #NEWLINE# 'request_status' : 'COMPLETED' , #NEWLINE# 'progress_percent' : 100 , #NEWLINE# #UNINDENT# } #NEWLINE# check_mock . side_effect = [ d1 , d2 ] #NEWLINE# client . check_request_status = check_mock #NEWLINE# client . wait_ambari_request ( 'id1' , 'c1' ) #NEWLINE# check_mock . assert_has_calls ( [ mock . call ( 'c1' , 'id1' ) , mock . call ( 'c1' , 'id1' ) ] )