<s> """<STR_LIT>""" <EOL> from django . template import Context <EOL> from django . test . utils import override_settings <EOL> from analytical . templatetags . uservoice import UserVoiceNode <EOL> from analytical . tests . utils import TagTestCase <EOL> from analytical . utils import AnalyticalException <EOL> @ override_settings ( USERVOICE_WIDGET_KEY = '<STR_LIT>' ) <EOL> class UserVoiceTagTestCase ( TagTestCase ) : <EOL> """<STR_LIT>""" <EOL> def assertIn ( self , element , container ) : <EOL> try : <EOL> super ( TagTestCase , self ) . assertIn ( element , container ) <EOL> except AttributeError : <EOL> self . assertTrue ( element in container ) <EOL> def test_node ( self ) : <EOL> r = UserVoiceNode ( ) . render ( Context ( ) ) <EOL> self . assertIn ( "<STR_LIT>" , r ) <EOL> def test_tag ( self ) : <EOL> r = self . render_tag ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertIn ( "<STR_LIT>" , r ) <EOL> @ override_settings ( USERVOICE_WIDGET_KEY = None ) <EOL> def test_no_key ( self ) : <EOL> self . assertRaises ( AnalyticalException , UserVoiceNode ) <EOL> @ override_settings ( USERVOICE_WIDGET_KEY = '<STR_LIT>' ) <EOL> def test_invalid_key ( self ) : <EOL> self . assertRaises ( AnalyticalException , UserVoiceNode ) <EOL> @ override_settings ( USERVOICE_WIDGET_KEY = '<STR_LIT>' ) <EOL> def test_empty_key ( self ) : <EOL> r = UserVoiceNode ( ) . render ( Context ( ) ) <EOL> self . assertEqual ( r , "<STR_LIT>" ) <EOL> @ override_settings ( USERVOICE_WIDGET_KEY = '<STR_LIT>' ) <EOL> def test_overridden_empty_key ( self ) : <EOL> vars = { '<STR_LIT>' : '<STR_LIT>' } <EOL> r = UserVoiceNode ( ) . render ( Context ( vars ) ) <EOL> self . assertIn ( "<STR_LIT>" , r ) <EOL> def test_overridden_key ( self ) : <EOL> vars = { '<STR_LIT>' : '<STR_LIT>' } <EOL> r = UserVoiceNode ( ) . render ( Context ( vars ) ) <EOL> self . assertIn ( "<STR_LIT>" , r ) <EOL> @ override_settings ( USERVOICE_WIDGET_OPTIONS = { '<STR_LIT>' : '<STR_LIT>' } ) <EOL> def test_options ( self ) : <EOL> r = UserVoiceNode ( ) . render ( Context ( ) ) <EOL> self . assertIn ( """<STR_LIT>""" , r ) <EOL> @ override_settings ( USERVOICE_WIDGET_OPTIONS = { '<STR_LIT>' : '<STR_LIT>' } ) <EOL> def test_override_options ( self ) : <EOL> data = { '<STR_LIT>' : { '<STR_LIT>' : '<STR_LIT>' } } <EOL> r = UserVoiceNode ( ) . render ( Context ( data ) ) <EOL> self . assertIn ( """<STR_LIT>""" , r ) <EOL> def test_auto_trigger ( self ) : <EOL> r = UserVoiceNode ( ) . render ( Context ( ) ) <EOL> self . assertTrue ( "<STR_LIT>" in r , r ) <EOL> @ override_settings ( USERVOICE_ADD_TRIGGER = False ) <EOL> def test_auto_trigger ( self ) : <EOL> r = UserVoiceNode ( ) . render ( Context ( ) ) <EOL> self . assertFalse ( "<STR_LIT>" in r , r ) <EOL> @ override_settings ( USERVOICE_ADD_TRIGGER = False ) <EOL> def test_auto_trigger_custom_win ( self ) : <EOL> r = UserVoiceNode ( ) . render ( Context ( { '<STR_LIT>' : True } ) ) <EOL> self . assertTrue ( "<STR_LIT>" in r , r ) </s>
