#NEWLINE# def testIsAllowedToPropose( self ) : #NEWLINE# #INDENT# 'Test PermissionResolver._IsAllowedToPropose().' #NEWLINE# test_resolver = auth . PermissionResolver ( 'task' ) #NEWLINE# email_one = 'user1@example.com' #NEWLINE# email_two = 'user2@example.com' #NEWLINE# email_three = 'user3@example.com' #NEWLINE# self . mox . StubOutWithMock ( auth , 'IsAdminUser' ) #NEWLINE# self . mox . StubOutWithMock ( auth , 'IsGroupMember' ) #NEWLINE# auth . IsAdminUser ( email_one ) . AndReturn ( True ) #NEWLINE# auth . IsAdminUser ( email_two ) . AndReturn ( False ) #NEWLINE# auth . IsGroupMember ( email_two , 'proposals_group' , remote_group_lookup = True ) . AndReturn ( True ) #NEWLINE# auth . IsAdminUser ( email_three ) . AndReturn ( False ) #NEWLINE# auth . IsGroupMember ( email_three , 'proposals_group' , remote_group_lookup = True ) . AndReturn ( False ) #NEWLINE# self . mox . ReplayAll ( ) #NEWLINE# test_resolver . email = email_one #NEWLINE# self . assertTrue ( test_resolver . _IsAllowedToPropose ( ) ) #NEWLINE# test_resolver . email = email_two #NEWLINE# self . assertTrue ( test_resolver . _IsAllowedToPropose ( ) ) #NEWLINE# test_resolver . email = email_two #NEWLINE# self . assertFalse ( test_resolver . _IsAllowedToPropose ( ) ) #NEWLINE# self . mox . VerifyAll ( )