#NEWLINE# def test_review_request_closed_email_hook_discarded( self ) : #NEWLINE# #INDENT# 'Testing the ReviewRequestClosedEmailHook for a review request being\n        discarded\n        ' #NEWLINE# class DummyHook ( ReviewRequestClosedEmailHook ) : #NEWLINE# #INDENT# def get_to_field( self , to_field , review_request , user , close_type ) : #NEWLINE# #INDENT# return set ( [ user ] ) #NEWLINE# #UNINDENT# def get_cc_field( self , cc_field , review_request , user , close_type ) : #NEWLINE# #INDENT# return set ( [ user ] ) #NEWLINE# #UNINDENT# #UNINDENT# hook = DummyHook ( self . extension ) #NEWLINE# self . spy_on ( hook . get_to_field ) #NEWLINE# self . spy_on ( hook . get_cc_field ) #NEWLINE# admin = User . objects . get ( username = 'admin' ) #NEWLINE# review_request = self . create_review_request ( public = True ) #NEWLINE# call_kwargs = { #NEWLINE# #INDENT# 'user' : admin , #NEWLINE# 'review_request' : review_request , #NEWLINE# 'close_type' : ReviewRequest . DISCARDED , #NEWLINE# #UNINDENT# } #NEWLINE# with set_siteconfig_settings ( { #NEWLINE# #INDENT# 'mail_send_review_close_mail' : True , #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# review_request . close ( ReviewRequest . DISCARDED , admin ) #NEWLINE# #UNINDENT# self . assertEqual ( len ( mail . outbox ) , 1 ) #NEWLINE# self . assertTrue ( hook . get_to_field . spy . called ) #NEWLINE# self . assertEqual ( hook . get_to_field . spy . calls [ 0 ] . kwargs , call_kwargs ) #NEWLINE# self . assertTrue ( hook . get_cc_field . spy . called ) #NEWLINE# self . assertEqual ( hook . get_cc_field . spy . calls [ 0 ] . kwargs , call_kwargs )