#NEWLINE# def test_it_should_get_destination_version_and_update_config_when_user_informs_a_label_and_it_exists_in_database( self ) : #NEWLINE# #INDENT# self . initial_config . update ( { #NEWLINE# #INDENT# 'schema_version' : None , #NEWLINE# 'label_version' : 'test_label' , #NEWLINE# 'database_migrations_dir' : [ 'migrations' , '.' ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# config = Config ( main . initial_config ) #NEWLINE# main = Main ( sgdb = Mock ( ** { #NEWLINE# #INDENT# 'get_version_number_from_label.return_value' : '20090214115300' , #NEWLINE# 'get_version_id_from_version_number.return_value' : 3 , #NEWLINE# #UNINDENT# } ) , config = config ) #NEWLINE# self . assertEqual ( '20090214115300' , main . _get_destination_version ( ) ) #NEWLINE# self . assertEqual ( '20090214115300' , config . get ( 'schema_version' ) ) #NEWLINE# main . sgdb . get_version_number_from_label . assert_called_with ( 'test_label' ) #NEWLINE# self . assertEqual ( 1 , main . sgdb . get_version_number_from_label . call_count ) #NEWLINE# main . sgdb . get_version_id_from_version_number . assert_called_with ( '20090214115300' ) #NEWLINE# self . assertEqual ( 1 , main . sgdb . get_version_id_from_version_number . call_count )