#NEWLINE# def test_request_view( ) : #NEWLINE# #INDENT# class app ( morepath . App ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# dectate . commit ( app ) #NEWLINE# def view( self , request ) : #NEWLINE# #INDENT# return { #NEWLINE# #INDENT# 'hey' : 'hey' , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# app . config . view_registry . register_view ( dict ( model = Model ) , view , render = render_json ) #NEWLINE# request = app ( ) . request ( get_environ ( path = '' ) ) #NEWLINE# model = Model ( ) #NEWLINE# response = resolve_response ( model , request ) #NEWLINE# assert ( model . body == b'{"hey": "hey"}' ) #NEWLINE# assert ( response . content_type == 'application/json' ) #NEWLINE# assert ( request . view ( model ) == { #NEWLINE# #INDENT# 'hey' : 'hey' , #NEWLINE# #UNINDENT# } )