#NEWLINE# def test_trove( self ) : #NEWLINE# #INDENT# fake_trove = fakes . FakeTroveClient ( ) #NEWLINE# mock_trove = mock . MagicMock ( ) #NEWLINE# mock_trove . client . Client = mock . MagicMock ( return_value = fake_trove ) #NEWLINE# self . assertNotIn ( 'trove' , self . clients . cache ) #NEWLINE# with mock . patch . dict ( 'sys.modules' , { #NEWLINE# #INDENT# 'troveclient' : mock_trove , #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# client = self . clients . trove ( ) #NEWLINE# self . assertEqual ( fake_trove , client ) #NEWLINE# kw = { #NEWLINE# #INDENT# 'username' : self . credential . username , #NEWLINE# 'api_key' : self . credential . password , #NEWLINE# 'project_id' : mock_trove . credential . tenant_name , #NEWLINE# 'auth_url' : self . credential . auth_url , #NEWLINE# 'region_name' : self . credential . region_name , #NEWLINE# 'timeout' : cfg . CONF . openstack_client_http_timeout , #NEWLINE# 'insecure' : self . credential . insecure , #NEWLINE# 'cacert' : self . credential . cacert , #NEWLINE# #UNINDENT# } #NEWLINE# mock_trove . client . Client . assert_called_once_with ( '1.0' , ** kw ) #NEWLINE# self . assertEqual ( fake_trove , self . clients . cache [ 'trove' ] )