#NEWLINE# @ mock . patch . object ( DummyClient , '_get_endpoint' ) #NEWLINE# @ mock . patch ( 'keystoneclient.session.Session' ) #NEWLINE# def test_get_session_with_endpoint( self , mock_session , mock_dummy_client__get_endpoint ) : #NEWLINE# #INDENT# osc = DummyClient ( self . credential , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# fake_endpoint = mock . Mock ( ) #NEWLINE# with mock . patch . object ( token_endpoint , 'Token' ) as token : #NEWLINE# #INDENT# osc . _get_session ( endpoint = fake_endpoint ) #NEWLINE# self . assertFalse ( mock_dummy_client__get_endpoint . called ) #NEWLINE# token . assert_called_once_with ( fake_endpoint , self . fake_keystone . auth_token ) #NEWLINE# mock_session . assert_called_once_with ( auth = token . return_value , verify = ( not self . credential . insecure ) , timeout = cfg . CONF . openstack_client_http_timeout )