#NEWLINE# def test_save_rename_sends_notification( self ) : #NEWLINE# #INDENT# self . flags ( enable = False , group = 'cells' ) #NEWLINE# old_ref = dict ( self . fake_instance , display_name = 'hello' ) #NEWLINE# fake_uuid = self [ 'uuid' ] #NEWLINE# expected_updates = dict ( display_name = 'goodbye' ) #NEWLINE# new_ref = dict ( old_ref , ** expected_updates ) #NEWLINE# self . mox . StubOutWithMock ( db , 'instance_get_by_uuid' ) #NEWLINE# self . mox . StubOutWithMock ( db , 'instance_update_and_get_original' ) #NEWLINE# self . mox . StubOutWithMock ( notifications , 'send_update' ) #NEWLINE# db . instance_get_by_uuid ( self . context , fake_uuid , columns_to_join = [ 'info_cache' , 'security_groups' ] ) . AndReturn ( old_ref ) #NEWLINE# db . instance_update_and_get_original ( self . context , fake_uuid , expected_updates , columns_to_join = [ 'info_cache' , 'security_groups' , 'system_metadata' , 'extra' , 'extra.flavor' ] ) . AndReturn ( ( old_ref , new_ref ) ) #NEWLINE# notifications . send_update ( self . context , mox . IgnoreArg ( ) , mox . IgnoreArg ( ) ) #NEWLINE# self . mox . ReplayAll ( ) #NEWLINE# inst = objects . Instance . get_by_uuid ( self . context , old_ref [ 'uuid' ] , use_slave = False ) #NEWLINE# self . assertEqual ( 'hello' , inst . display_name ) #NEWLINE# inst . display_name = 'goodbye' #NEWLINE# inst . save ( ) #NEWLINE# self . assertEqual ( 'goodbye' , inst . display_name ) #NEWLINE# self . assertEqual ( set ( [ ] ) , ( inst . obj_what_changed ( ) - set ( [ 'flavor' ] ) ) )