#NEWLINE# @ patch ( 'simple_db_migrate.main.Main._get_migration_files_to_be_executed' , side_effect = Exception ( 'error getting migrations to execute' ) ) #NEWLINE# @ patch ( 'simple_db_migrate.main.Main._execution_log' ) #NEWLINE# def test_it_should_raise_exception_and_stop_process_when_an_error_occur_on_getting_migrations_to_execute_and_is_down( self , _execution_log_mock , files_to_be_executed_mock ) : #NEWLINE# #INDENT# self . initial_config . update ( { #NEWLINE# #INDENT# 'schema_version' : '20090214115400' , #NEWLINE# 'label_version' : None , #NEWLINE# 'database_migrations_dir' : [ 'migrations' , '.' ] , #NEWLINE# 'show_sql' : True , #NEWLINE# #UNINDENT# } ) #NEWLINE# config = Config ( self . initial_config ) #NEWLINE# main = Main ( sgdb = Mock ( ** { #NEWLINE# #INDENT# 'get_current_schema_version.return_value' : '20090214115600' , #NEWLINE# 'get_version_id_from_version_number.side_effect' : get_version_id_from_version_number_side_effect , #NEWLINE# #UNINDENT# } ) , config = config ) #NEWLINE# self . assertRaisesWithMessage ( Exception , 'error getting migrations to execute' , main . execute ) #NEWLINE# expected_calls = [ call ( '\nStarting DB migration on host/database "localhost/test" with user "user"...' , 'PINK' , log_level_limit = 1 ) ] #NEWLINE# self . assertEqual ( expected_calls , _execution_log_mock . mock_calls ) #NEWLINE# files_to_be_executed_mock . assert_called_with ( '20090214115600' , '20090214115400' , False ) #NEWLINE# expected_calls = [ ] #NEWLINE# self . assertEqual ( expected_calls , main . sgdb . change . mock_calls )