#NEWLINE# @ mock . patch ( 'flask_via.import_module' ) #NEWLINE# def test_endpoint_prefix( self , _import_module ) : #NEWLINE# #INDENT# routes1 = copy . deepcopy ( self . routes ) #NEWLINE# routes1 . append ( Include ( 'foo.bar' , endpoint = 'endpoint2' ) ) #NEWLINE# routes2 = copy . deepcopy ( self . routes ) #NEWLINE# _import_module . side_effect = [ mock . MagicMock ( routes = routes1 ) , mock . MagicMock ( routes = self ) ] #NEWLINE# include = Include ( 'foo.bar' , endpoint = 'endpoint1' ) #NEWLINE# include . add_to_app ( self . app ) #NEWLINE# self . assertEqual ( url_for ( 'endpoint1.foo' ) , '/foo' ) #NEWLINE# self . assertEqual ( url_for ( 'endpoint1.bar' ) , '/bar' ) #NEWLINE# self . assertEqual ( url_for ( 'endpoint1.endpoint2.foo' ) , '/foo' ) #NEWLINE# self . assertEqual ( url_for ( 'endpoint1.endpoint2.bar' ) , '/bar' )