def test_user_redirect_deprecated(app):
 name = 'wash'
 cookies = app.login_user(name)
 r = get_page('/user/baduser', app, cookies=cookies, hub=False)
 r.raise_for_status()
 print urlparse(r.url)
 path = urlparse(r.url).path
 assert (path == ujoin(app.base_url, ('/user/%s' % name)))
 r = get_page('/user/baduser/test.ipynb', app, cookies=cookies, hub=False)
 r.raise_for_status()
 print urlparse(r.url)
 path = urlparse(r.url).path
 assert (path == ujoin(app.base_url, ('/user/%s/test.ipynb' % name)))
 r = get_page('/user/baduser/test.ipynb', app, hub=False)
 r.raise_for_status()
 print urlparse(r.url)
 path = urlparse(r.url).path
 assert (path == ujoin(app.base_url, '/hub/login'))
 query = urlparse(r.url).query
 assert (query == urlencode({'next': ujoin(app.base_url, '/hub/user/baduser/test.ipynb')}))

def test_user_redirect_deprecated ( app ) : name = 'wash' cookies = app . login_user ( name ) r = get_page ( '/user/baduser' , app , cookies = cookies , hub = False ) r . raise_for_status ( ) print urlparse ( r . url ) path = urlparse ( r . url ) . path assert ( path == ujoin ( app . base_url , ( '/user/%s' % name ) ) ) r = get_page ( '/user/baduser/test.ipynb' , app , cookies = cookies , hub = False ) r . raise_for_status ( ) print urlparse ( r . url ) path = urlparse ( r . url ) . path assert ( path == ujoin ( app . base_url , ( '/user/%s/test.ipynb' % name ) ) ) r = get_page ( '/user/baduser/test.ipynb' , app , hub = False ) r . raise_for_status ( ) print urlparse ( r . url ) path = urlparse ( r . url ) . path assert ( path == ujoin ( app . base_url , '/hub/login' ) ) query = urlparse ( r . url ) . query assert ( query == urlencode ( { 'next' : ujoin ( app . base_url , '/hub/user/baduser/test.ipynb' ) } ) )
redirecting from /user/someonelse/ urls .