Ejemplo n.º 1
0
    def insert_random_seller(self, repeat=qsellers):
        ''' Inserir registros com valores randomicos '''

        seller_list = []
        for _ in range(repeat):
            d = gen_timestamp(2014, 2015) + '+00'
            fname = names.get_first_name()
            lname = names.get_last_name()
            email = fname[0].lower() + '.' + lname.lower() + '@example.com'
            birthday = gen_timestamp() + '+00'
            active = rstr.rstr('01', 1)
            internal = rstr.rstr('01', 1)
            commissioned = rstr.rstr('01', 1)
            commission = 0.01
            seller_list.append(
                (gen_cpf(), fname, lname, email, gen_phone(), birthday, active, internal, commissioned, commission, d, d))
        try:
            self.db.cursor.executemany("""
            INSERT INTO vendas_seller (cpf, firstname, lastname, email, phone, birthday, active, internal, commissioned, commission, created, modified)
            VALUES (?,?,?,?,?,?,?,?,?,?,?,?)
            """, seller_list)
            self.db.commit_db()
            print("Inserindo %s registros na tabela vendas_seller." % repeat)
            print("Registros criados com sucesso.")
        except sqlite3.IntegrityError:
            print("Aviso: O email deve ser único.")
            return False
Ejemplo n.º 2
0
    def insert_random_customer(self, repeat=qcustomers):
        ''' Inserir registros com valores randomicos '''

        customer_list = []
        for _ in range(repeat):
            # d = datetime.datetime.now().isoformat(" ")
            d = gen_timestamp(2014, 2015) + '+00'
            fname = names.get_first_name()
            lname = names.get_last_name()
            email = fname[0].lower() + '.' + lname.lower() + '@example.com'
            birthday = gen_timestamp() + '+00'
            customer_list.append(
                (gen_cpf(), fname, lname, email, gen_phone(), birthday, d, d))
        try:
            self.db.cursor.executemany("""
            INSERT INTO vendas_customer (cpf, firstname, lastname, email, phone, birthday, created, modified)
            VALUES (?,?,?,?,?,?,?,?)
            """, customer_list)
            self.db.commit_db()
            print("Inserindo %s registros na tabela vendas_customer." % repeat)
            print("Registros criados com sucesso.")
        except sqlite3.IntegrityError:
            print("Aviso: O email deve ser único.")
            return False
Ejemplo n.º 3
0
    ['id_company', choice(company_list)],
    ['id_department', choice(department_list)],
    ['id_occupation', 'Arquiteto'],
]

for field in fields:
    search = page.find_element_by_id(field[0])
    search.send_keys(field[1])
    # time.sleep(0.5)

button = page.find_element_by_link_text('Documentos')
button.click()

fields = [
    ['id_photo', photo],
    ['id_cpf', gen_cpf()],
    ['id_rg', gen_rg()],
]

for field in fields:
    search = page.find_element_by_id(field[0])
    search.send_keys(field[1])
    # time.sleep(0.5)

button = page.find_element_by_link_text('Endereço')
button.click()

fields = [
    ['id_address', address_list[INDEX]['address']],
    ['id_complement', 'Apto 303'],
    ['id_district', address_list[INDEX]['district']],
Ejemplo n.º 4
0
search = page.find_element_by_id(gender)
search.click()

INDEX = randint(0, 146)

fields = [
    ['id_treatment', treatment],
    ['id_first_name', first_name],
    ['id_last_name', last_name],
    ['id_slug', slug],
    ['id_photo', photo],
    ['id_company', choice(company_list)],
    ['id_department', choice(department_list)],
    ['id_occupation', 'Estagiário'],
    ['id_email', email],
    ['id_cpf', gen_cpf()],
    ['id_rg', gen_rg()],
    ['id_address', address_list[INDEX]['address']],
    ['id_complement', str(randint(1, 30)) + 'º andar'],
    ['id_district', address_list[INDEX]['district']],
    ['id_city', address_list[INDEX]['city']],
    ['id_uf', address_list[INDEX]['city']],  # deixa city mesmo
    ['id_cep', address_list[INDEX]['cep']],
]

for field in fields:
    search = page.find_element_by_id(field[0])
    search.send_keys(field[1])

# button = page.find_element_by_id('id_submit')
button = page.find_element_by_class_name('btn-primary')