<s> import re <EOL> from django . core import mail <EOL> from django . contrib . auth . models import User <EOL> from tddspry . django . helpers import EMAIL , PASSWORD , USERNAME <EOL> __all__ = ( '<STR_LIT>' , ) <EOL> def activate ( obj , word = '<STR_LIT>' , url = '<STR_LIT>' ) : <EOL> """<STR_LIT>""" <EOL> obj . assert_equal ( len ( mail . outbox ) , <NUM_LIT:1> ) <EOL> body = mail . outbox [ <NUM_LIT:0> ] . body <EOL> match = re . search ( '<STR_LIT>' % word , body ) <EOL> assert match , '<STR_LIT>' % body <EOL> code = match . groups ( ) [ <NUM_LIT:0> ] <EOL> obj . go200 ( url , args = [ code [ : - <NUM_LIT:1> ] ] ) <EOL> def registration ( obj , username = None , email = None , password = None , <EOL> verbosity = False , <EOL> registration_url = '<STR_LIT>' , <EOL> registration_formid = <NUM_LIT:1> , <EOL> registration_tos = False , <EOL> activate_word = '<STR_LIT>' , <EOL> activation_url = '<STR_LIT>' , <EOL> login_url = None , <EOL> login_formid = <NUM_LIT:1> ) : <EOL> """<STR_LIT>""" <EOL> obj . go200 ( registration_url ) <EOL> obj . find ( '<STR_LIT>' '<STR_LIT>' ) <EOL> submit ( obj , username , email , password , registration_formid , <EOL> registration_tos ) <EOL> if verbosity : <EOL> obj . show ( ) <EOL> user = User . objects . get ( username = USERNAME ) <EOL> obj . assert_false ( user . is_active , <EOL> '<STR_LIT>' ) <EOL> activate ( obj , activate_word , activation_url ) <EOL> if verbosity : <EOL> obj . show ( ) <EOL> user = User . objects . get ( username = USERNAME ) <EOL> obj . assert_true ( user . is_active , '<STR_LIT>' ) <EOL> obj . login ( USERNAME , PASSWORD , login_url , login_formid ) <EOL> def submit ( obj , username = None , email = None , password = None , formid = None , <EOL> tos = False ) : <EOL> """<STR_LIT>""" <EOL> formid = formid or <NUM_LIT:1> <EOL> obj . formvalue ( formid , '<STR_LIT:username>' , username or USERNAME ) <EOL> obj . formvalue ( formid , '<STR_LIT:email>' , email or EMAIL ) <EOL> obj . formvalue ( formid , '<STR_LIT>' , password or PASSWORD ) <EOL> obj . formvalue ( formid , '<STR_LIT>' , password or PASSWORD ) <EOL> if tos : <EOL> obj . formvalue ( formid , '<STR_LIT>' , '<STR_LIT>' ) <EOL> obj . submit200 ( ) </s>
