#NEWLINE# def login_with_permissions( self , * codenames ) : #NEWLINE# #INDENT# 'Helper to login as a user with correct permissions' #NEWLINE# perms = Permission . objects . filter ( codename__in = perms ) #NEWLINE# self . perm_user = factories . User ( ) #NEWLINE# self . perm_user . user_permissions . add ( * perms ) #NEWLINE# self . perm_user . save ( ) #NEWLINE# self . login_user ( self . perm_user )