#NEWLINE# def test_redirects_without_credentials( self ) : #NEWLINE# #INDENT# request = self . factory . get ( '/test' ) #NEWLINE# request . session = response . session #NEWLINE# @ decorators . oauth_required #NEWLINE# def test_view( request ) : #NEWLINE# #INDENT# return http . HttpResponse ( 'test' ) #NEWLINE# #UNINDENT# response = test_view ( request ) #NEWLINE# self . assertTrue ( isinstance ( response , http . HttpResponseRedirect ) ) #NEWLINE# self . assertEquals ( parse . urlparse ( response [ 'Location' ] ) . path , '/oauth2/oauth2authorize/' ) #NEWLINE# self . assertTrue ( ( 'return_url=%2Ftest' in parse . urlparse ( response [ 'Location' ] ) . query ) ) #NEWLINE# self . assertEquals ( response . status_code , 302 )