#NEWLINE# def test_views_with_other_user( self ) : #NEWLINE# #INDENT# user = UserFactory . create ( ) #NEWLINE# usergroup = UserGroupFactory . create ( ) #NEWLINE# view = UserGroupData . as_view ( ) #NEWLINE# request = HttpRequest ( ) #NEWLINE# request . method = 'GET' #NEWLINE# request . user = user #NEWLINE# setattr ( request , 'session' , 'session' ) #NEWLINE# messages = FallbackStorage ( request ) #NEWLINE# setattr ( request , '_messages' , messages ) #NEWLINE# response = view ( request , project_id = usergroup . project . id , usergroup_id = usergroup . id ) . render ( ) #NEWLINE# response = render_helpers . remove_csrf ( unicode ( response . content ) ) #NEWLINE# rendered = render_to_string ( 'users/usergroup_data.html' , { #NEWLINE# #INDENT# 'error_description' : 'Project matching query does not exist.' , #NEWLINE# 'error' : 'Not found.' , #NEWLINE# 'user' : user , #NEWLINE# 'messages' : get_messages ( request ) , #NEWLINE# 'PLATFORM_NAME' : get_current_site ( request ) . name , #NEWLINE# 'GEOKEY_VERSION' : version . get_version ( ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( response , rendered ) #NEWLINE# category = CategoryFactory . create ( ** { #NEWLINE# #INDENT# 'project' : usergroup . project , #NEWLINE# #UNINDENT# } ) #NEWLINE# request = HttpRequest ( ) #NEWLINE# request . method = 'POST' #NEWLINE# request . user = user #NEWLINE# request . POST = { #NEWLINE# #INDENT# 'permission' : 'restricted' , #NEWLINE# 'filters' : ( '{ "%s": { } }' % category . id ) , #NEWLINE# #UNINDENT# } #NEWLINE# setattr ( request , 'session' , 'session' ) #NEWLINE# messages = FallbackStorage ( request ) #NEWLINE# setattr ( request , '_messages' , messages ) #NEWLINE# response = view ( request , project_id = usergroup . project . id , usergroup_id = usergroup . id ) . render ( ) #NEWLINE# response = render_helpers . remove_csrf ( unicode ( response . content ) ) #NEWLINE# rendered = render_to_string ( 'users/usergroup_data.html' , { #NEWLINE# #INDENT# 'error_description' : 'Project matching query does not exist.' , #NEWLINE# 'error' : 'Not found.' , #NEWLINE# 'user' : user , #NEWLINE# 'messages' : get_messages ( request ) , #NEWLINE# 'PLATFORM_NAME' : get_current_site ( request ) . name , #NEWLINE# 'GEOKEY_VERSION' : version . get_version ( ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( response , rendered ) #NEWLINE# self . assertIsNone ( Group . objects . get ( pk = usergroup . id ) . filters )