<s> from watson . events import types <EOL> from watson . framework import applications , views <EOL> from watson . framework . debug . panels import Application <EOL> from watson . routing import routes <EOL> class TestApplication ( object ) : <EOL> def setup ( self ) : <EOL> app = applications . Http ( ) <EOL> p = Application ( <EOL> { '<STR_LIT>' : True } , app . container . get ( '<STR_LIT>' ) , app ) <EOL> self . app = app <EOL> self . panel = p <EOL> def test_route_name ( self ) : <EOL> assert not self . panel . route_name <EOL> self . panel . route_match = routes . RouteMatch ( <EOL> routes . LiteralRoute ( '<STR_LIT:test>' , '<STR_LIT:/>' ) , { } ) <EOL> assert self . panel . route_name == '<STR_LIT:test>' <EOL> def test_controller ( self ) : <EOL> assert not self . panel . controller <EOL> self . panel . route_match = routes . RouteMatch ( <EOL> routes . LiteralRoute ( '<STR_LIT:test>' , '<STR_LIT:/>' , options = { '<STR_LIT>' : '<STR_LIT:test>' } ) , { } ) <EOL> assert self . panel . controller == '<STR_LIT:test>' <EOL> def test_template ( self ) : <EOL> self . panel . view_model = views . Model ( template = '<STR_LIT:test>' ) <EOL> assert self . panel . template == '<STR_LIT:test>' <EOL> def test_usage ( self ) : <EOL> assert self . panel . usage > <NUM_LIT:0> <EOL> def test_route_match_listener ( self ) : <EOL> rm = routes . RouteMatch ( '<STR_LIT:test>' , { } ) <EOL> params = { <EOL> '<STR_LIT>' : { '<STR_LIT>' : rm } <EOL> } <EOL> event = types . Event ( '<STR_LIT:name>' , params = params ) <EOL> self . panel . route_match_listener ( event ) <EOL> assert self . panel . route_match is rm <EOL> def test_render_listener ( self ) : <EOL> vm = views . Model ( ) <EOL> params = { <EOL> '<STR_LIT>' : vm <EOL> } <EOL> event = types . Event ( '<STR_LIT:name>' , params = params ) <EOL> self . panel . render_listener ( event ) <EOL> assert self . panel . view_model is vm <EOL> def test_render ( self ) : <EOL> self . panel . view_model = views . Model ( format = '<STR_LIT:html>' ) <EOL> output = self . panel . render ( ) <EOL> assert '<STR_LIT>' in output <EOL> def test_key_stat ( self ) : <EOL> assert self . panel . render_key_stat ( ) . endswith ( '<STR_LIT>' ) </s>
