#NEWLINE# @ patch . object ( occ . cloud_config . CloudConfig , 'get_api_version' ) #NEWLINE# @ patch . object ( OperatorCloud , 'keystone_client' ) #NEWLINE# def test_grant_role_user_project_v2_wait( self , mock_keystone , mock_api_version ) : #NEWLINE# #INDENT# mock_api_version . return_value = '2.0' #NEWLINE# mock_keystone . roles . list . return_value = [ self . fake_role ] #NEWLINE# mock_keystone . tenants . list . return_value = [ self . fake_project ] #NEWLINE# mock_keystone . users . list . return_value = [ self . fake_user ] #NEWLINE# mock_keystone . roles . roles_for_user . side_effect = [ [ ] , [ ] , [ self . fake_role ] ] #NEWLINE# mock_keystone . roles . add_user_role . return_value = self . fake_role #NEWLINE# self . assertTrue ( self . cloud . grant_role ( mock_keystone . fake_role [ 'name' ] , user = self . fake_user [ 'name' ] , project = self . fake_project [ 'id' ] , wait = True ) )