<s> from django . core . management import setup_environ <EOL> import settings <EOL> setup_environ ( settings ) <EOL> from news import models , tests <EOL> class B : <EOL> pass <EOL> import random <EOL> run_name = '<STR_LIT>' . join ( [ random . choice ( '<STR_LIT>' ) for i in xrange ( <NUM_LIT:10> ) ] ) <EOL> b = B ( ) <EOL> user = models . User . objects . create_user ( username = "<STR_LIT>" % run_name , email = "<STR_LIT>" , password = "<STR_LIT>" ) <EOL> user . save ( ) <EOL> b . user = user <EOL> profile = models . UserProfile ( user = user , karma = <NUM_LIT> ) <EOL> profile . save ( ) <EOL> topic = models . Topic . objects . create_new_topic ( user = b . user , topic_name = '<STR_LIT>' % run_name , full_name = '<STR_LIT>' ) <EOL> b . topic = topic <EOL> num_user = <NUM_LIT:1000> <EOL> num_links = <NUM_LIT> <EOL> num_votes = <NUM_LIT:100> <EOL> users = [ ] <EOL> for i in xrange ( num_user ) : <EOL> user = models . UserProfile . objects . create_user ( user_name = '<STR_LIT>' % ( run_name , i ) , email = '<STR_LIT>' , password = '<STR_LIT>' ) <EOL> users . append ( user ) <EOL> profile = b . user . get_profile ( ) <EOL> profile . karma = <NUM_LIT> <EOL> profile . save ( ) <EOL> b . user = models . User . objects . get ( id = b . user . id ) <EOL> links = [ ] <EOL> for i in xrange ( num_links ) : <EOL> link = models . Link . objects . create_link ( user = b . user , topic = b . topic , url = '<STR_LIT>' % ( run_name , i ) , text = str ( i ) ) <EOL> links . append ( link ) <EOL> for user in users : <EOL> votes = random . randint ( <NUM_LIT:2> , num_votes ) <EOL> for i in xrange ( votes ) : <EOL> link = random . choice ( links ) <EOL> print i , link , user <EOL> link . upvote ( user ) </s>
