<s> from watson . framework import views <EOL> from watson . framework . views . decorators import view <EOL> class MyController ( object ) : <EOL> @ view ( format = '<STR_LIT>' ) <EOL> def xml_action ( self , * args , ** kwargs ) : <EOL> return { } <EOL> @ view ( format = '<STR_LIT>' ) <EOL> def xml_full_mime_action ( self ) : <EOL> return { } <EOL> @ view ( format = '<STR_LIT:html>' , template = '<STR_LIT:test>' ) <EOL> def html_action ( self ) : <EOL> return { } <EOL> @ view ( format = '<STR_LIT>' ) <EOL> def bool_action ( self ) : <EOL> return True <EOL> class TestViewDecorator ( object ) : <EOL> def test_view_model_format ( self ) : <EOL> controller = MyController ( ) <EOL> controller_response = controller . xml_action ( ) <EOL> assert isinstance ( controller_response , views . Model ) <EOL> assert controller_response . format == '<STR_LIT>' <EOL> assert controller . xml_full_mime_action ( ) . format == '<STR_LIT>' <EOL> def test_view_model_template ( self ) : <EOL> controller = MyController ( ) <EOL> controller_response = controller . html_action ( ) <EOL> assert isinstance ( controller_response , views . Model ) <EOL> assert controller_response . format == '<STR_LIT:html>' <EOL> assert controller_response . template == '<STR_LIT:test>' <EOL> def test_view_model_response ( self ) : <EOL> controller = MyController ( ) <EOL> controller_response = controller . bool_action ( ) <EOL> assert controller_response . data [ '<STR_LIT:content>' ] </s>
