#NEWLINE# def test_update_with_remove_and_add_name( self ) : #NEWLINE# #INDENT# '\n        Tests that a SecretData already stored in the database can be\n        updated. This will store a SecretData in the database. It will\n        remove a name and add another one to it in one session, and then\n        retrieve it in another session to verify that it has all of the correct\n        names. This simulates multiple operation being sent for the same\n        object.\n        ' #NEWLINE# names = [ 'bowser' , 'frumpy' , 'big fat cat' ] #NEWLINE# obj = SecretData ( self . bytes_a , enums . SecretDataType . PASSWORD , name = names [ 0 ] ) #NEWLINE# obj . names . append ( names [ 1 ] ) #NEWLINE# obj . names . append ( names [ 2 ] ) #NEWLINE# Session = sessionmaker ( bind = self . engine ) #NEWLINE# session = Session ( ) #NEWLINE# session . add ( obj ) #NEWLINE# session . commit ( ) #NEWLINE# session = Session ( ) #NEWLINE# update_obj = session . query ( SecretData ) . filter ( ( ManagedObject . unique_identifier == obj . unique_identifier ) ) . one ( ) #NEWLINE# update_obj . names . pop ( ) #NEWLINE# update_obj . names . pop ( ) #NEWLINE# update_obj . names . append ( 'dog' ) #NEWLINE# session . commit ( ) #NEWLINE# expected_names = [ 'bowser' , 'dog' ] #NEWLINE# expected_mo_names = list ( ) #NEWLINE# expected_mo_names . append ( sqltypes . ManagedObjectName ( expected_names [ 0 ] , 0 ) ) #NEWLINE# expected_mo_names . append ( sqltypes . ManagedObjectName ( expected_names [ 1 ] , 3 ) ) #NEWLINE# session = Session ( ) #NEWLINE# get_obj = session . query ( SecretData ) . filter ( ( ManagedObject . unique_identifier == obj . unique_identifier ) ) . one ( ) #NEWLINE# session . commit ( ) #NEWLINE# self . assertEquals ( expected_names , get_obj . names ) #NEWLINE# self . assertEquals ( expected_mo_names , names . _names )