#NEWLINE# @ patch ( 'pyrax.manager.BaseManager' , new = fakes . FakeManager ) #NEWLINE# def test_get_flavor_ref_for_name( self ) : #NEWLINE# #INDENT# clt = self . client #NEWLINE# info = { #NEWLINE# #INDENT# 'id' : 1 , #NEWLINE# 'name' : 'test_flavor' , #NEWLINE# 'ram' : 42 , #NEWLINE# 'links' : [ { #NEWLINE# #INDENT# 'href' : example_uri , #NEWLINE# 'rel' : 'self' , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } #NEWLINE# flavor_obj = CloudDatabaseFlavor ( clt . _manager , info ) #NEWLINE# clt . get_flavor = Mock ( side_effect = exc . NotFound ( '' ) ) #NEWLINE# clt . list_flavors = Mock ( return_value = [ flavor_obj ] ) #NEWLINE# ret = clt . _get_flavor_ref ( 'test_flavor' ) #NEWLINE# self . assertEqual ( ret , example_uri )