#NEWLINE# def test_process_request_superuser( self ) : #NEWLINE# #INDENT# 'Superusers should be able to impersonate.' #NEWLINE# self . admin . is_superuser = True #NEWLINE# self . admin . save ( ) #NEWLINE# self . assertTrue ( self . admin . can_impersonate ( ) ) #NEWLINE# middleware = ImpersonationMiddleware ( ) #NEWLINE# request = self . request_factory . get ( '/' ) #NEWLINE# request . session = { #NEWLINE# #INDENT# 'impersonate_id' : self . user . pk , #NEWLINE# #UNINDENT# } #NEWLINE# request . user = self . admin #NEWLINE# middleware . process_request ( middleware ) #NEWLINE# self . assertEqual ( request . user , self . user )