<s> from __future__ import unicode_literals <EOL> import os <EOL> from nose . tools import raises , eq_ , ok_ <EOL> from werkzeug . test import Client <EOL> from werkzeug . wrappers import BaseResponse <EOL> from clastic import Application <EOL> from clastic . render import ashes <EOL> from clastic . render import AshesRenderFactory , render_basic <EOL> from common import hello_world_ctx , complex_context <EOL> _TMPL_DIR = os . path . join ( os . path . dirname ( __file__ ) , '<STR_LIT>' ) <EOL> def test_ashes ( ) : <EOL> ashes_render = AshesRenderFactory ( _TMPL_DIR ) <EOL> tmpl = '<STR_LIT>' <EOL> app = Application ( [ ( '<STR_LIT:/>' , hello_world_ctx , tmpl ) , <EOL> ( '<STR_LIT>' , hello_world_ctx , tmpl ) , <EOL> ( '<STR_LIT>' , complex_context , tmpl ) ] , <EOL> render_factory = ashes_render ) <EOL> c = Client ( app , BaseResponse ) <EOL> resp = c . get ( '<STR_LIT:/>' ) <EOL> yield eq_ , resp . status_code , <NUM_LIT:200> <EOL> yield ok_ , '<STR_LIT>' in resp . data <EOL> resp = c . get ( '<STR_LIT>' ) <EOL> yield eq_ , resp . status_code , <NUM_LIT:200> <EOL> yield ok_ , '<STR_LIT>' in resp . data <EOL> @ raises ( ashes . TemplateNotFound ) <EOL> def test_ashes_missing_template ( ) : <EOL> ashes_render = AshesRenderFactory ( _TMPL_DIR ) <EOL> tmpl = '<STR_LIT>' <EOL> return Application ( [ ( '<STR_LIT:/>' , hello_world_ctx , tmpl ) ] , <EOL> render_factory = ashes_render ) <EOL> def test_ashes_mixed ( ) : <EOL> ashes_render = AshesRenderFactory ( _TMPL_DIR ) <EOL> tmpl = '<STR_LIT>' <EOL> app = Application ( [ ( '<STR_LIT:/>' , hello_world_ctx , tmpl ) , <EOL> ( '<STR_LIT>' , hello_world_ctx , render_basic ) ] , <EOL> render_factory = ashes_render ) <EOL> c = Client ( app , BaseResponse ) <EOL> resp = c . get ( '<STR_LIT:/>' ) <EOL> yield eq_ , resp . status_code , <NUM_LIT:200> <EOL> yield ok_ , '<STR_LIT>' in resp . data <EOL> resp = c . get ( '<STR_LIT>' ) <EOL> yield eq_ , resp . status_code , <NUM_LIT:200> </s>
