#NEWLINE# def test_images_from_a_banned_user_are_visible_to_banned_user( self ) : #NEWLINE# #INDENT# 'Images posted by banned members are visible to the banned member.' #NEWLINE# banned_user = self . create_user ( is_banned = True ) #NEWLINE# group = mommy . make ( Group ) #NEWLINE# banned_user . add_to_group ( group . pk ) #NEWLINE# self . user2 . add_to_group ( group . pk ) #NEWLINE# thread = mommy . make ( 'connectmessages.Thread' , group = group ) #NEWLINE# message = mommy . make ( 'connectmessages.Message' , thread = thread , sender = banned_user ) #NEWLINE# image1 = Image ( ) #NEWLINE# image1 . user = message . sender #NEWLINE# image1 . image = File ( open ( self . smallfile ) ) #NEWLINE# image1 . save ( ) #NEWLINE# message . images . add ( image1 ) #NEWLINE# client = Client ( ) #NEWLINE# client . post ( reverse ( 'login' ) , { #NEWLINE# #INDENT# 'username' : banned_user . email , #NEWLINE# 'password' : 'moo' , #NEWLINE# #UNINDENT# } ) #NEWLINE# result = client . get ( reverse ( 'group_images' , kwargs = { #NEWLINE# #INDENT# 'group_id' : group . pk , #NEWLINE# #UNINDENT# } ) ) #NEWLINE# self . assertIn ( image1 , result . context [ 'images' ] )