#NEWLINE# def test_database_arg_m2m( self ) : #NEWLINE# #INDENT# '\n        Test that the m2m_changed signal has a correct database arg (#13552)\n        ' #NEWLINE# receiver = DatabaseReceiver ( ) #NEWLINE# signals . m2m_changed . connect ( receiver = receiver ) #NEWLINE# b = Book . objects . create ( title = 'Pro Django' , published = datetime . date ( 2008 , 12 , 16 ) ) #NEWLINE# p = Person . objects . create ( name = 'Marty Alchin' ) #NEWLINE# Book . objects . using ( 'other' ) . create ( pk = b . pk , title = b . title , published = b . published ) #NEWLINE# Person . objects . using ( 'other' ) . create ( pk = p . pk , name = p . name ) #NEWLINE# b . authors . add ( p ) #NEWLINE# self . assertEqual ( receiver . _database , DEFAULT_DB_ALIAS ) #NEWLINE# self . _write_to_other ( ) #NEWLINE# b . authors . add ( p ) #NEWLINE# self . _write_to_default ( ) #NEWLINE# self . assertEqual ( receiver . _database , 'other' ) #NEWLINE# b . authors . remove ( p ) #NEWLINE# self . assertEqual ( receiver . _database , DEFAULT_DB_ALIAS ) #NEWLINE# self . _write_to_other ( ) #NEWLINE# b . authors . remove ( p ) #NEWLINE# self . _write_to_default ( ) #NEWLINE# self . assertEqual ( receiver . _database , 'other' ) #NEWLINE# p . book_set . add ( b ) #NEWLINE# self . assertEqual ( receiver . _database , DEFAULT_DB_ALIAS ) #NEWLINE# self . _write_to_other ( ) #NEWLINE# p . book_set . add ( b ) #NEWLINE# self . _write_to_default ( ) #NEWLINE# self . assertEqual ( receiver . _database , 'other' ) #NEWLINE# b . authors . clear ( ) #NEWLINE# self . assertEqual ( receiver . _database , DEFAULT_DB_ALIAS ) #NEWLINE# self . _write_to_other ( ) #NEWLINE# b . authors . clear ( ) #NEWLINE# self . _write_to_default ( ) #NEWLINE# self . assertEqual ( receiver . _database , 'other' )