#NEWLINE# def test_with_user_message_not_approved_user_is_sender( self ) : #NEWLINE# #INDENT# 'Images that are not approved should be returned to the sender.' #NEWLINE# thread = mommy . make ( 'connectmessages.Thread' , group = self . group ) #NEWLINE# message = mommy . make ( 'connectmessages.Message' , thread = thread , sender = self . super_user , status = 'spam' ) #NEWLINE# image1 = Image ( ) #NEWLINE# image1 . user = message . sender #NEWLINE# image1 . image = File ( open ( self . smallfile ) ) #NEWLINE# image1 . save ( ) #NEWLINE# message . images . add ( image1 ) #NEWLINE# result = self . client . get ( reverse ( 'admin_gallery' ) ) #NEWLINE# self . assertEqual ( result . status_code , 200 ) #NEWLINE# self . assertIn ( image1 , result . context [ 'images' ] )