#NEWLINE# @ mock . patch . object ( models . User , 'is_authenticated' , False ) #NEWLINE# def test_stacked_mixins_not_logged_in( self ) : #NEWLINE# #INDENT# user = models . User . objects . create ( username = 'joe' , password = 'qwerty' ) #NEWLINE# perms = models . Permission . objects . filter ( codename__in = ( 'add_customuser' , 'change_customuser' ) ) #NEWLINE# user . user_permissions . add ( * perms ) #NEWLINE# request = self . factory . get ( '/rand' ) #NEWLINE# request . user = user #NEWLINE# view = StackedMixinsView1 . as_view ( ) #NEWLINE# with self . assertRaises ( PermissionDenied ) : #NEWLINE# #INDENT# view ( request ) #NEWLINE# #UNINDENT# view = StackedMixinsView2 . as_view ( ) #NEWLINE# with self . assertRaises ( PermissionDenied ) : #NEWLINE# #INDENT# view ( request )