#NEWLINE# def test_safe_redirect( ) : #NEWLINE# #INDENT# ( app , db , admin ) = setup ( ) #NEWLINE# ( Model1 , _ ) = create_models ( db ) #NEWLINE# db . create_all ( ) #NEWLINE# view = CustomModelView ( Model1 , db . session ) #NEWLINE# admin . add_view ( view ) #NEWLINE# client = app . test_client ( ) #NEWLINE# rv = client . post ( '/admin/model1/new/?url=http://localhost/admin/model2view/' , data = dict ( test1 = 'test1large' , test2 = 'test2' ) ) #NEWLINE# eq_ ( rv . status_code , 302 ) #NEWLINE# eq_ ( rv . location , 'http://localhost/admin/model2view/' ) #NEWLINE# rv = client . post ( '/admin/model1/new/?url=http://google.com/evil/' , data = dict ( test1 = 'test1large' , test2 = 'test2' ) ) #NEWLINE# eq_ ( rv . status_code , 302 ) #NEWLINE# eq_ ( rv . location , 'http://localhost/admin/model1/' )