Beispiel #1
0
def run_test_INvalid_register_tenant(times):
    for i in range(times):
        temp = test_register(generate_username_INvalid_chars(),
                             generate_email_valid(), generate_password_valid(),
                             True, "tenant")

        temp = test_register(generate_username_INvalid_taken(),
                             generate_email_valid(), generate_password_valid(),
                             True, "tenant")

        temp = test_register(generate_username_valid(), generate_email_valid(),
                             generate_password_valid(), False, "tenant")
def register(username=generate_username_valid(),
             email=generate_email_valid(),
             password=generate_password_valid()):
    driver.get("http://127.0.0.1:8000/logout/")
    driver.get("http://127.0.0.1:8000/register/admin/")
    # username
    input_username = WebDriverWait(driver, 10).until(
        EC.presence_of_element_located((By.NAME, "username")))
    input_username.clear()
    input_username.send_keys(username)

    # email
    input_email = WebDriverWait(driver, 10).until(
        EC.presence_of_element_located((By.NAME, "email")))
    input_email.clear()
    input_email.send_keys(email)

    # password1
    input_password1 = WebDriverWait(driver, 10).until(
        EC.presence_of_element_located((By.NAME, "password1")))
    input_password1.clear()
    input_password1.send_keys(password)

    # password2
    input_password2 = WebDriverWait(driver, 10).until(
        EC.presence_of_element_located((By.NAME, "password2")))
    input_password2.clear()
    input_password2.send_keys(password)

    # press enter
    input_password2.send_keys(Keys.RETURN)
    return
Beispiel #3
0
def run_test_valid_register_tenant(times):
    with open(filename, "r+") as file:
        data = json.load(file)

    for i in range(times):
        temp = test_register(generate_username_valid(), generate_email_valid(),
                             generate_password_valid(), True, "tenant")
        data['accounts'].append(temp)

    with open(filename, 'w') as f:
        json.dump(data, f, indent=4)

    file.close()
    f.close()