#NEWLINE# def test_deferred_deferred_link( ) : #NEWLINE# #INDENT# class root ( morepath . App ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# class alpha ( morepath . App ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# class beta ( morepath . App ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# @ root . path ( path = '' ) #NEWLINE# class RootModel ( object ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# @ root . view ( model = RootModel ) #NEWLINE# def root_model_default( self , request ) : #NEWLINE# #INDENT# return request . link ( AlphaModel ( ) ) #NEWLINE# #UNINDENT# @ alpha . path ( path = '' ) #NEWLINE# class AlphaModel ( object ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# @ beta . path ( path = '' ) #NEWLINE# class BetaModel ( object ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# @ beta . view ( model = BetaModel ) #NEWLINE# def beta_model_default( self , request ) : #NEWLINE# #INDENT# return request . link ( AlphaModel ( ) ) #NEWLINE# #UNINDENT# @ root . mount ( app = alpha , path = 'alpha' ) #NEWLINE# def mount_alpha( ) : #NEWLINE# #INDENT# return alpha ( ) #NEWLINE# #UNINDENT# @ root . mount ( app = beta , path = 'beta' ) #NEWLINE# def mount_beta( ) : #NEWLINE# #INDENT# return beta ( ) #NEWLINE# #UNINDENT# @ beta . defer_links ( model = AlphaModel ) #NEWLINE# def defer_links_parent( app , obj ) : #NEWLINE# #INDENT# return app . parent #NEWLINE# #UNINDENT# @ root . defer_links ( model = AlphaModel ) #NEWLINE# def defer_links_alpha( app , obj ) : #NEWLINE# #INDENT# return app . child ( alpha ( ) ) #NEWLINE# #UNINDENT# c = Client ( root ( ) ) #NEWLINE# response = c . get ( '/' ) #NEWLINE# assert ( response . body == b'http://localhost/alpha' ) #NEWLINE# response = c . get ( '/beta' ) #NEWLINE# assert ( response . body == b'http://localhost/alpha' )