<s> from __future__ import unicode_literals <EOL> from bs4 import BeautifulSoup , NavigableString <EOL> from django . forms . models import modelform_factory <EOL> from django . test import TestCase as DjangoTestCase <EOL> from django . utils . html import conditional_escape <EOL> from wysihtml5 . tests . models import ModelTest <EOL> from wysihtml5 . widgets import ( Wysihtml5TextareaWidget , <EOL> render_cmd_icon , render_cmd_dialog ) <EOL> class Wysihtml5ToolbarTestCase ( DjangoTestCase ) : <EOL> def setUp ( self ) : <EOL> ModelForm = modelform_factory ( ModelTest ) <EOL> self . soup = BeautifulSoup ( ModelForm ( ) . __str__ ( ) ) <EOL> def test_command_disabled_in_settings ( self ) : <EOL> cmd_format_block = self . soup . find ( '<STR_LIT>' , attrs = { <EOL> '<STR_LIT>' : '<STR_LIT>' } ) <EOL> cmd_fore_color = self . soup . find ( '<STR_LIT>' , attrs = { <EOL> '<STR_LIT>' : '<STR_LIT>' } ) <EOL> self . assert_ ( cmd_format_block != None ) <EOL> self . assert_ ( cmd_fore_color == None ) <EOL> def test_dialog_disabled_in_settings ( self ) : <EOL> dialog_insert_image = self . soup . find ( '<STR_LIT>' , attrs = { <EOL> '<STR_LIT>' : '<STR_LIT>' } ) <EOL> dialog_create_link = self . soup . find ( '<STR_LIT>' , attrs = { <EOL> '<STR_LIT>' : '<STR_LIT>' } ) <EOL> self . assert_ ( dialog_insert_image != None ) <EOL> self . assert_ ( dialog_create_link == None ) <EOL> class Wysihtml5TextareaWidgetTestCase ( DjangoTestCase ) : <EOL> def test_render_wysihtml5admintextarea_widget ( self ) : <EOL> neilmsg = ModelTest . objects . create ( <EOL> first_text = "<STR_LIT>" , <EOL> second_text = "<STR_LIT>" ) <EOL> w = Wysihtml5TextareaWidget ( ) <EOL> rendered = conditional_escape ( w . render ( "<STR_LIT:test>" , neilmsg . second_text ) ) <EOL> expected = '<STR_LIT>' <EOL> self . maxDiff = None <EOL> self . assertHTMLEqual ( expected , rendered ) </s>
