#NEWLINE# @ patch ( 'pyrax.clouddatabases.CloudDatabaseInstance' , new = fakes . FakeDatabaseInstance ) #NEWLINE# def test_mgr_restore_backup( self ) : #NEWLINE# #INDENT# inst = self . instance #NEWLINE# mgr = inst . manager #NEWLINE# name = utils . random_unicode ( ) #NEWLINE# flavor = utils . random_unicode ( ) #NEWLINE# fref = utils . random_unicode ( ) #NEWLINE# volume = utils . random_unicode ( ) #NEWLINE# backup = utils . random_unicode ( ) #NEWLINE# mgr . api . method_post = Mock ( return_value = ( None , { #NEWLINE# #INDENT# 'instance' : { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) ) #NEWLINE# mgr . api . _get_flavor_ref = Mock ( return_value = fref ) #NEWLINE# expected_uri = ( '/%s' % mgr . uri_base ) #NEWLINE# expected_body = { #NEWLINE# #INDENT# 'instance' : { #NEWLINE# #INDENT# 'name' : name , #NEWLINE# 'flavorRef' : fref , #NEWLINE# 'volume' : { #NEWLINE# #INDENT# 'size' : volume , #NEWLINE# #UNINDENT# } , #NEWLINE# 'restorePoint' : { #NEWLINE# #INDENT# 'backupRef' : backup , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# mgr . restore_backup ( backup , name , flavor , volume ) #NEWLINE# mgr . api . method_post . assert_called_once_with ( expected_uri , body = expected_body )