from random import randrange
import pytest

from fixture.TestBase import clear
from fixture.variables import Profinity
from contract_lib import Contact
from fixture.TestBase import random_string


test_data = [
    Contact(first_name=first_name, middle_name=middle_name, last_name=last_name, nickname=nickname, title=title,
            company_name=company_name, address_name=address_name, home=home, mobile=mobile, work=work, fax=fax,
            email1=email1, email2=email2, email3=email3, homepage=homepage, address=address, phone=phone, notes=notes,
            id=id, contact_name=contact_name)

    for first_name in ['', random_string('first_name', 10)]
    for middle_name in ['', random_string('middle_name', 20)]
    for last_name in ['', random_string('last_name', 20)]
    for nickname in [random_string('nickname', 10)]
    for title in [random_string('title', 20)]
    for company_name in [random_string('company_name', 20)]
    for address_name in [random_string('address_name', 10)]
    for home in [random_string('home', 20)]
    for mobile in [random_string('mobile', 20)]
    for work in [random_string('work', 10)]
    for fax in [random_string('fax', 20)]
    for email1 in [random_string('email1', 20)]
    for email2 in [random_string('email2', 10)]
    for email3 in [random_string('email3', 20)]
    for homepage in [random_string('homepage', 20)]
    for address in [random_string('address', 10)]
Example #2
0


from fixture.TestBase import random_string

from tests_group.group_helper import Group


constant = [
    Group(group_name='name1', group_header='header1', group_footer='footer1'),
    Group(group_name='name1', group_header='header1', group_footer='footer1')
]

test_data = [
    Group(group_name=name, group_header=header, group_footer=footer)
    for name in ['', random_string('name', 10)]
    for header in ['', random_string('header', 20)]
    for footer in ['', random_string('footer', 20)]]
Example #3
0



try:
    opts, args = getopt.getopt(sys.argv[1:], "n:f:", ["number of groups", "file"])
except getopt.GetoptError as err:

    getopt.usage()
    sys.exit(2)

n = 5
f = 'data/groups.json'

for o, a in opts:
    if o == "-n":
        n=int(a)
    elif o == "-f":
        f = str(a)


file = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", f)
test_data = [Group(group_name='', group_header='', group_footer='')] + [Group(group_name=random_string('name', 10),
                                                                              group_header=random_string('header', 10),
                                                                              group_footer=random_string('footer', 10))
                                                                              for i in range(n)]

																			  
with open(file, 'w') as out:
    jsonpickle.set_encoder_options("json", indent=2)
    out.write(jsonpickle.encode(test_data))
Example #4
0
     address_name=address_name,
     home=home,
     mobile=mobile,
     work=work,
     fax=fax,
     email1=email1,
     email2=email2,
     email3=email3,
     homepage=homepage,
     address=address,
     phone=phone,
     notes=notes,
     id=id,
     contact_name=contact_name,
 )
 for first_name in ["", random_string("first_name", 10)]
 for middle_name in ["", random_string("middle_name", 20)]
 for last_name in ["", random_string("last_name", 20)]
 for nickname in [random_string("nickname", 10)]
 for title in [random_string("title", 20)]
 for company_name in [random_string("company_name", 20)]
 for address_name in [random_string("address_name", 10)]
 for home in [random_string("home", 20)]
 for mobile in [random_string("mobile", 20)]
 for work in [random_string("work", 10)]
 for fax in [random_string("fax", 20)]
 for email1 in [random_string("email1", 20)]
 for email2 in [random_string("email2", 10)]
 for email3 in [random_string("email3", 20)]
 for homepage in [random_string("homepage", 20)]
 for address in [random_string("address", 10)]
Example #5
0
from fixture.TestBase import random_string

from tests_group.group_helper import Group

constant = [
    Group(group_name='name1', group_header='header1', group_footer='footer1'),
    Group(group_name='name1', group_header='header1', group_footer='footer1')
]

test_data = [
    Group(group_name=name, group_header=header, group_footer=footer)
    for name in ['', random_string('name', 10)]
    for header in ['', random_string('header', 20)]
    for footer in ['', random_string('footer', 20)]
]
Example #6
0
    sys.exit(2)

n = 5
f = 'data/contact.json'

for o, a in opts:
    if o == "-n":
        n=int(a)
    elif o == "-f":
        f = str(a)

test_data = [
    Contact(first_name='', middle_name='', last_name='', nickname='', title='',
            company_name='', address_name='', home='', mobile='', work='', fax='',
            email1='', email2='', email3='', homepage='', address='', phone='', notes='',
            id='', contact_name='')]+[Contact(first_name=random_string('first_name', 10),
                                              middle_name=random_string('middle_name', 20),
                                              last_name=random_string('last_name', 20),
                                              nickname=random_string('nickname', 10),
                                              title=random_string('title', 20),
                                              company_name=random_string('company_name', 20),
                                              address_name=random_string('address_name', 10),
                                              home=random_string('home', 20),
                                              mobile=random_string('mobile', 20),
                                              work=random_string('work', 10),
                                              fax=random_string('fax', 20),
                                              email1=random_string('email1', 20),
                                              email2=random_string('email2', 10),
                                              email3=random_string('email3', 20),
                                              homepage=random_string('homepage', 20),
                                              address=random_string('address', 10),
Example #7
0
    sys.exit(2)

n = 5
f = 'data/groups.json'

for o, a in opts:
    if o == "-n":
        n = int(a)
    elif o == "-f":
        f = str(a)
'''def random_string(prefix, maxlen):
    symbols = string.ascii_letters + string.digits + ' ' #+ string.punctuation
    return prefix + ''.join([random.choice(symbols) for i in range(random.randrange(maxlen))])'''
'''
test_data = [
    Group(group_name=name, group_header=header, group_footer=footer)
    for name in ['', random_string('name', 10)]
    for header in ['', random_string('header', 20)]
    for footer in ['', random_string('footer', 20)]]'''

test_data = [Group(group_name='', group_header='', group_footer='')] + [
    Group(group_name=random_string('name', 10),
          group_header=random_string('header', 10),
          group_footer=random_string('footer', 10)) for i in range(n)
]

file = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", f)

with open(file, 'w') as out:
    jsonpickle.set_encoder_options("json", indent=2)
    out.write(jsonpickle.encode(test_data))
Example #8
0
         company_name=company_name,
         address_name=address_name,
         home=home,
         mobile=mobile,
         work=work,
         fax=fax,
         email1=email1,
         email2=email2,
         email3=email3,
         homepage=homepage,
         address=address,
         phone=phone,
         notes=notes,
         id=id,
         contact_name=contact_name)
 for first_name in ['', random_string('first_name', 10)]
 for middle_name in ['', random_string('middle_name', 20)]
 for last_name in ['', random_string('last_name', 20)]
 for nickname in [random_string('nickname', 10)]
 for title in [random_string('title', 20)]
 for company_name in [random_string('company_name', 20)]
 for address_name in [random_string('address_name', 10)]
 for home in [random_string('home', 20)]
 for mobile in [random_string('mobile', 20)]
 for work in [random_string('work', 10)]
 for fax in [random_string('fax', 20)]
 for email1 in [random_string('email1', 20)]
 for email2 in [random_string('email2', 10)]
 for email3 in [random_string('email3', 20)]
 for homepage in [random_string('homepage', 20)]
 for address in [random_string('address', 10)]