#NEWLINE# def test_foreign_key_deletion( self ) : #NEWLINE# #INDENT# 'Cascaded deletions of Foreign Key relations issue queries on the right database' #NEWLINE# mark = Person . objects . using ( 'other' ) . create ( name = 'Mark Pilgrim' ) #NEWLINE# Pet . objects . using ( 'other' ) . create ( name = 'Fido' , owner = self ) #NEWLINE# self . assertEqual ( Person . objects . using ( 'default' ) . count ( ) , 0 ) #NEWLINE# self . assertEqual ( Pet . objects . using ( 'default' ) . count ( ) , 0 ) #NEWLINE# self . assertEqual ( Person . objects . using ( 'other' ) . count ( ) , 1 ) #NEWLINE# self . assertEqual ( Pet . objects . using ( 'other' ) . count ( ) , 1 ) #NEWLINE# mark . delete ( using = 'other' ) #NEWLINE# self . assertEqual ( Person . objects . using ( 'default' ) . count ( ) , 0 ) #NEWLINE# self . assertEqual ( Pet . objects . using ( 'default' ) . count ( ) , 0 ) #NEWLINE# self . assertEqual ( Person . objects . using ( 'other' ) . count ( ) , 0 ) #NEWLINE# self . assertEqual ( Pet . objects . using ( 'other' ) . count ( ) , 0 )