#NEWLINE# def test_facebook_eligibility( self ) : #NEWLINE# #INDENT# self . election . eligibility = [ { #NEWLINE# #INDENT# 'auth_system' : 'facebook' , #NEWLINE# 'constraint' : [ { #NEWLINE# #INDENT# 'group' : { #NEWLINE# #INDENT# 'id' : '123' , #NEWLINE# 'name' : 'Fake Group' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } ] #NEWLINE# self . assertFalse ( self . election . user_eligible_p ( self . fb_user ) ) #NEWLINE# self . election . openreg = True #NEWLINE# from helios_auth.auth_systems import facebook #NEWLINE# def fake_check_constraint( constraint , user ) : #NEWLINE# #INDENT# return ( ( constraint == { #NEWLINE# #INDENT# 'group' : { #NEWLINE# #INDENT# 'id' : '123' , #NEWLINE# 'name' : 'Fake Group' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) and ( user == self . fb_user ) ) #NEWLINE# #UNINDENT# facebook . check_constraint = fake_check_constraint #NEWLINE# self . assertTrue ( self . election . user_eligible_p ( self . fb_user ) ) #NEWLINE# self . assertEquals ( self . election . eligibility_category_id ( 'facebook' ) , '123' )