#NEWLINE# @ patch ( 'sys.stdin' , return_value = '\n' , ** { #NEWLINE# #INDENT# 'readline.return_value' : '\n' , #NEWLINE# #UNINDENT# } ) #NEWLINE# @ patch ( 'sys.stdout' , new_callable = StringIO ) #NEWLINE# @ patch ( 'simple_db_migrate.main.Main._get_migration_files_to_be_executed' , return_value = [ Migration ( file_name = '20090214115500_05_test_migration.migration' , version = '20090214115500' , sql_up = 'sql up 05' , sql_down = 'sql down 05' ) , Migration ( file_name = '20090214115600_06_test_migration.migration' , version = '20090214115600' , sql_up = 'sql up 06' , sql_down = 'sql down 06' ) ] ) #NEWLINE# def test_it_should_pause_execution_after_each_migration_when_paused_mode_is_set_and_is_up( self , files_to_be_executed_mock , stdout_mock , stdin_mock ) : #NEWLINE# #INDENT# self . initial_config . update ( { #NEWLINE# #INDENT# 'schema_version' : '20090214115600' , #NEWLINE# 'label_version' : None , #NEWLINE# 'database_migrations_dir' : [ 'migrations' , '.' ] , #NEWLINE# 'paused_mode' : True , #NEWLINE# #UNINDENT# } ) #NEWLINE# config = Config ( self . initial_config ) #NEWLINE# main = Main ( sgdb = Mock ( ** { #NEWLINE# #INDENT# 'change.return_value' : None , #NEWLINE# 'get_current_schema_version.return_value' : '20090214115400' , #NEWLINE# 'get_version_id_from_version_number.side_effect' : get_version_id_from_version_number_side_effect , #NEWLINE# #UNINDENT# } ) , config = config ) #NEWLINE# main . execute ( ) #NEWLINE# self . assertEqual ( 2 , stdout_mock . getvalue ( ) . count ( '* press <enter> to continue...' ) ) #NEWLINE# expected_calls = [ call ( 'sql up 05' , '20090214115500' , '20090214115500_05_test_migration.migration' , 'sql up 05' , 'sql down 05' , True , main . _execution_log , None ) , call ( 'sql up 06' , '20090214115600' , '20090214115600_06_test_migration.migration' , 'sql up 06' , 'sql down 06' , True , main . _execution_log , None ) ] #NEWLINE# self . assertEqual ( expected_calls , stdout_mock . sgdb . change . mock_calls )