#NEWLINE# def setUp( self ) : #NEWLINE# #INDENT# '\n        Create two users with `attachments.add_attachment` permission\n        and one object to attach files to.\n        ' #NEWLINE# content_type = ContentType . objects . get_for_model ( Attachment ) #NEWLINE# self . add_permission = Permission . objects . get ( content_type = content_type , codename = 'add_attachment' ) #NEWLINE# self . del_permission = Permission . objects . get ( content_type = content_type , codename = 'delete_attachment' ) #NEWLINE# self . del_foreign_permission = Permission . objects . get ( content_type = content_type , codename = 'delete_foreign_attachments' ) #NEWLINE# self . cred_jon = { #NEWLINE# #INDENT# 'username' : 'jon' , #NEWLINE# 'password' : 'foobar' , #NEWLINE# #UNINDENT# } #NEWLINE# self . cred_jane = { #NEWLINE# #INDENT# 'username' : 'jane' , #NEWLINE# 'password' : 'foobar' , #NEWLINE# #UNINDENT# } #NEWLINE# self . jon = User . objects . create_user ( ** self . cred_jon ) #NEWLINE# self . jon . user_permissions . add ( self . add_permission ) #NEWLINE# self . jon . user_permissions . add ( self . del_permission ) #NEWLINE# self . jane = User . objects . create_user ( ** self . cred_jane ) #NEWLINE# self . jane . user_permissions . add ( self . add_permission ) #NEWLINE# self . jane . user_permissions . add ( self . del_permission ) #NEWLINE# self . obj = TestModel . objects . create ( title = 'My first test item' )