Guest User

Untitled

a guest
May 21st, 2018
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.70 KB | None | 0 0
  1. from model.contact import Contact
  2. import random
  3. import string
  4.  
  5. Constant = [
  6. Contact(firstname="firstname1", middlename="middlename1", lastname="lastname1", \
  7. nickname="nickname1", title="title1", company="company1" address="address1", \
  8. homephone="homephone1", mobilephone="mobilephone1", workphone ="workphone1", fax="fax1", \
  9. email_1 ="amail_11", email_2="email_21", email_3="email_31", homepage="homepage1", \
  10. byear="byear1", ayear="ayear1", city ="city1", secondaryphone="seconfdaryphone1", notes_here="notice_here1"),
  11.  
  12. Contact(firstname="firstname2", middlename="middlename2", lastname="lastname2", \
  13. nickname="nickname2", title="title2", company="company2" address="address2", \
  14. homephone="homephone2", mobilephone="mobilephone2", workphone ="workphone2", fax="fax2", \
  15. email_1 ="amail_12", email_2="email_22", email_3="email_32", homepage="homepage2", \
  16. byear="byear2", ayear="ayear2", city ="city2", secondaryphone="seconfdaryphone2", notes_here="notice_here2") + [\
  17. ]
  18.  
  19. def random_string(prefix, maxlen):
  20. symbols = string.ascii_letters + string.digits + " "*10
  21. return prefix + "".join([random.choice(symbols) for i in range(random.randrange(maxlen))])
  22.  
  23. testdata = [Contact(firstname ='', middlename ='', lastname ='', \
  24. nickname ='', title = '', company ='', address ='', \
  25. homephone ='', mobilephone ='', workphone = '', fax ='', \
  26. email_1 ='', email_2 ='', email_3 ='', homepage ='', \
  27. byear ='', ayear='', city ='', secondaryphone='', notes_here ='')] + [\
  28. Contact(firstname =random_string("firstname", 10).strip(),middlename= random_string("middlename", 10).strip(),
  29. lastname =random_string("lastname", 10).strip(), \
  30. nickname =random_string("nickname", 10).strip(), title = random_string("title", 10).strip(),
  31. company =random_string("company", 10).strip(), address =random_string("address", 10).strip(), \
  32. homephone =random_string("homephone", 10).strip(), mobilephone =random_string("mobilephone", 10).strip(),
  33. workphone = random_string("workphone", 10).strip(), fax =random_string("fax", 10).strip(), \
  34. email_1 =random_string("email_1", 10).strip(), email_2 =random_string("email_2", 10).strip(),
  35. email_3 =random_string("email_3", 10).strip(), homepage =random_string("homepage", 10).strip(), \
  36. byear =random_string("byear", 10).strip(), ayear=random_string("ayear", 10).strip(),
  37. city =random_string("city", 10).strip(), secondaryphone=random_string("secondaryphone", 10).strip(),
  38. notes_here =random_string("notes_here", 10).strip())\
  39. for i in range(5)]
Add Comment
Please, Sign In to add comment