<s> from django . contrib . auth . models import User <EOL> from django . core . management import call_command <EOL> from django . test import TestCase <EOL> from account . models import SignupCode <EOL> from pinax . invitations . models import ( <EOL> JoinInvitation , <EOL> InvitationStat , <EOL> ) <EOL> class TestsJoinInvitation ( TestCase ) : <EOL> def setUp ( self ) : <EOL> self . to_user = User . objects . create ( username = "<STR_LIT>" ) <EOL> self . from_user = User . objects . create ( username = "<STR_LIT>" ) <EOL> self . signup_code = SignupCode . create ( email = "<STR_LIT>" ) <EOL> self . signup_code . save ( ) <EOL> self . status = JoinInvitation . STATUS_ACCEPTED <EOL> self . invitation = JoinInvitation . objects . create ( <EOL> from_user = self . from_user , <EOL> status = self . status , <EOL> signup_code = self . signup_code , <EOL> ) <EOL> def test_to_user_email ( self ) : <EOL> self . assertEqual ( self . signup_code . email , "<STR_LIT>" ) <EOL> def test_accept ( self ) : <EOL> self . invitation . accept ( self . to_user ) <EOL> self . assertEqual ( self . from_user . invitationstat . invites_accepted , <NUM_LIT:1> ) <EOL> def test_process_independent_joins ( self ) : <EOL> JoinInvitation . process_independent_joins ( self . to_user , "<STR_LIT>" ) <EOL> invite = JoinInvitation . objects . get ( pk = self . invitation . pk ) <EOL> self . assertEqual ( invite . status , JoinInvitation . STATUS_JOINED_INDEPENDENTLY ) <EOL> class TestsManagement ( TestCase ) : <EOL> def test_topoff_invites ( self ) : <EOL> """<STR_LIT>""" <EOL> user = User . objects . create ( username = "<STR_LIT>" ) <EOL> call_command ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> call_command ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> istat = InvitationStat . objects . get ( user = user ) <EOL> self . assertEqual ( istat . invites_remaining ( ) , <NUM_LIT:10> ) <EOL> def test_add_invites ( self ) : <EOL> """<STR_LIT>""" <EOL> user = User . objects . create ( username = "<STR_LIT>" ) <EOL> call_command ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> call_command ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> istat = InvitationStat . objects . get ( user = user ) <EOL> self . assertEqual ( istat . invites_remaining ( ) , <NUM_LIT:20> ) </s>
