@@ -2244,13 +2244,14 @@ def test_action_file_rename(self):
22442244 'kind' : 'file' ,
22452245 },
22462246 )
2247- with capture_notifications ():
2247+ with capture_notifications () as notifications :
22482248 self .app .put (
22492249 url ,
22502250 json = payload ,
22512251 )
22522252 self .preprint .reload ()
2253-
2253+ assert len (notifications ['emits' ]) == 1
2254+ assert notifications ['emits' ][0 ]['type' ] == NotificationType .Type .ADDON_FILE_RENAMED
22542255 assert self .preprint .logs .latest ().action == 'osf_storage_addon_file_renamed'
22552256
22562257 def test_action_downloads_contrib (self ):
@@ -2278,9 +2279,11 @@ def test_add_file_osfstorage_log(self):
22782279 url = self .preprint .api_url_for ('create_waterbutler_log' )
22792280 payload = self .build_payload (metadata = {'nid' : self .preprint ._id , 'materialized' : path , 'kind' : 'file' , 'path' : path })
22802281 nlogs = self .preprint .logs .count ()
2281- with capture_notifications ():
2282+ with capture_notifications () as notifications :
22822283 self .app .put (url , json = payload )
22832284 self .preprint .reload ()
2285+ assert len (notifications ['emits' ]) == 1
2286+ assert notifications ['emits' ][0 ]['type' ] == NotificationType .Type .FILE_ADDED
22842287 assert self .preprint .logs .count () == nlogs + 1
22852288 assert ('urls' in self .preprint .logs .filter (action = 'osf_storage_file_added' )[0 ].params )
22862289
@@ -2289,9 +2292,11 @@ def test_add_folder_osfstorage_log(self):
22892292 url = self .preprint .api_url_for ('create_waterbutler_log' )
22902293 payload = self .build_payload (metadata = {'nid' : self .preprint ._id , 'materialized' : path , 'kind' : 'folder' , 'path' : path })
22912294 nlogs = self .preprint .logs .count ()
2292- with capture_notifications ():
2295+ with capture_notifications () as notifications :
22932296 self .app .put (url , json = payload )
22942297 self .preprint .reload ()
2298+ assert len (notifications ['emits' ]) == 1
2299+ assert notifications ['emits' ][0 ]['type' ] == NotificationType .Type .FILE_ADDED
22952300 assert self .preprint .logs .count () == nlogs + 1
22962301 assert ('urls' not in self .preprint .logs .filter (action = 'osf_storage_file_added' )[0 ].params )
22972302
0 commit comments