<s> from django . test import TestCase <EOL> from django . test . utils import override_settings <EOL> @ override_settings ( ADMINS = ( ( '<STR_LIT>' , '<STR_LIT>' ) , ) , <EOL> EMAIL_SUBJECT_PREFIX = "<STR_LIT>" ) <EOL> class TestApplyReporter ( TestCase ) : <EOL> def _makeOne ( self , * args , ** kwargs ) : <EOL> from reportmail . command import apply_reporter <EOL> return apply_reporter ( * args , ** kwargs ) <EOL> def test__it ( self ) : <EOL> class DummySelf ( object ) : <EOL> __module__ = '<STR_LIT>' <EOL> wrapper = self . _makeOne ( "<STR_LIT>" ) <EOL> def wrapped ( self , reporter , * args , ** options ) : <EOL> reporter . append ( "<STR_LIT>" ) <EOL> return reporter , args , options <EOL> r , a , o = wrapper ( wrapped ) ( DummySelf ( ) , '<STR_LIT>' , test = '<STR_LIT>' ) <EOL> self . assertEqual ( r . subject , "<STR_LIT>" ) <EOL> self . assertEqual ( r . template , '<STR_LIT>' ) <EOL> self . assertEqual ( r . base_context , { '<STR_LIT:args>' : a , '<STR_LIT>' : o , <EOL> '<STR_LIT>' : '<STR_LIT>' } ) <EOL> self . assertEqual ( r . stored_text , [ "<STR_LIT>" ] ) <EOL> self . assertEqual ( a , ( '<STR_LIT>' , ) ) <EOL> self . assertEqual ( o , { '<STR_LIT:test>' : '<STR_LIT>' } ) <EOL> from django . core import mail <EOL> self . assertEqual ( len ( mail . outbox ) , <NUM_LIT:1> ) <EOL> self . assertEqual ( mail . outbox [ <NUM_LIT:0> ] . subject , '<STR_LIT>' ) <EOL> self . assertEqual ( mail . outbox [ <NUM_LIT:0> ] . body , """<STR_LIT>""" ) <EOL> def test__additional_context ( self ) : <EOL> class DummySelf ( object ) : <EOL> __module__ = '<STR_LIT>' <EOL> wrapper = self . _makeOne ( "<STR_LIT>" , additional_context = { '<STR_LIT>' : '<STR_LIT:data>' } ) <EOL> def wrapped ( self , reporter , * args , ** options ) : <EOL> reporter . append ( "<STR_LIT>" ) <EOL> return reporter , args , options <EOL> r , a , o = wrapper ( wrapped ) ( DummySelf ( ) , '<STR_LIT>' , test = '<STR_LIT>' ) <EOL> self . assertEqual ( r . subject , "<STR_LIT>" ) <EOL> self . assertEqual ( r . template , '<STR_LIT>' ) <EOL> self . assertEqual ( r . base_context , { '<STR_LIT:args>' : a , '<STR_LIT>' : o , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:data>' } ) <EOL> self . assertEqual ( r . stored_text , [ "<STR_LIT>" ] ) <EOL> self . assertEqual ( a , ( '<STR_LIT>' , ) ) <EOL> self . assertEqual ( o , { '<STR_LIT:test>' : '<STR_LIT>' } ) <EOL> from django . core import mail <EOL> self . assertEqual ( len ( mail . outbox ) , <NUM_LIT:1> ) <EOL> self . assertEqual ( mail . outbox [ <NUM_LIT:0> ] . subject , '<STR_LIT>' ) <EOL> self . assertEqual ( mail . outbox [ <NUM_LIT:0> ] . body , """<STR_LIT>""" ) <EOL> def test__unexpected_error_occurred ( self ) : <EOL> class DummySelf ( object ) : <EOL> __module__ = '<STR_LIT>' <EOL> wrapper = self . _makeOne ( "<STR_LIT>" ) <EOL> def wrapped ( self , reporter , * args , ** options ) : <EOL> reporter . append ( "<STR_LIT>" ) <EOL> raise Exception ( "<STR_LIT>" ) <EOL> with self . assertRaises ( Exception ) : <EOL> wrapper ( wrapped ) ( DummySelf ( ) , '<STR_LIT>' , test = '<STR_LIT>' ) <EOL> from django . core import mail <EOL> self . assertEqual ( len ( mail . outbox ) , <NUM_LIT:1> ) <EOL> self . assertEqual ( mail . outbox [ <NUM_LIT:0> ] . subject , '<STR_LIT>' ) <EOL> self . assertEqual ( mail . outbox [ <NUM_LIT:0> ] . body [ : <NUM_LIT> ] , """<STR_LIT>""" ) </s>
