#NEWLINE# @ mock . patch ( 'nashvegas.utils.get_all_migrations' ) #NEWLINE# @ mock . patch ( 'nashvegas.utils.get_applied_migrations' ) #NEWLINE# def test_handles_duplicate_migration_numbers( self , get_applied_migrations , get_all_migrations ) : #NEWLINE# #INDENT# get_applied_migrations . return_value = { #NEWLINE# #INDENT# 'dupes' : [ '0001.sql' , '0002_foo.sql' ] , #NEWLINE# #UNINDENT# } #NEWLINE# get_all_migrations . return_value = { #NEWLINE# #INDENT# 'dupes' : [ ( 1 , '0001.sql' ) , ( 2 , '0002_bar.sql' ) , ( 2 , '0002_foo.sql' ) ] , #NEWLINE# #UNINDENT# } #NEWLINE# path = join ( mig_root , 'multidb' ) #NEWLINE# results = dict ( get_pending_migrations ( path ) ) #NEWLINE# get_applied_migrations . assert_called_once_with ( None ) #NEWLINE# get_all_migrations . assert_called_once_with ( path , None ) #NEWLINE# self . assertEquals ( len ( results ) , 1 ) #NEWLINE# self . assertTrue ( ( 'dupes' in results ) ) #NEWLINE# self . assertEquals ( len ( results [ 'dupes' ] ) , 1 ) #NEWLINE# self . assertTrue ( ( '0002_bar.sql' in results [ 'dupes' ] ) )