#NEWLINE# @ patch ( 'pyramid.threadlocal.get_current_registry' ) #NEWLINE# def test_notify_packages_added( self , getreg ) : #NEWLINE# #INDENT# from cheeseprism.index import notify_packages_added #NEWLINE# pkg = dict ( name = 'pkg' , version = '0.1' ) #NEWLINE# pkgs = ( pkg , ) #NEWLINE# index = Mock ( name = 'index' ) #NEWLINE# reg = getreg . return_value = Mock ( name = 'registry' ) #NEWLINE# out = list ( notify_packages_added ( index , pkgs ) ) #NEWLINE# assert ( len ( out ) == 1 ) #NEWLINE# assert getreg . called #NEWLINE# assert reg . notify . called #NEWLINE# ( ( event , ) , _ ) = reg . notify . call_args #NEWLINE# assert ( event . im is index ) #NEWLINE# assert ( pkg . version == '0.1' ) #NEWLINE# assert ( event . name == 'pkg' )