def create_employees(account, info, url, driver, result, need_create_employee=False): tenant_info = info['tenant'] tenant_name_prefix = tenant_info['name'] tenant_index = tenant_info['start-point'] tenant_index_limit = tenant_index + tenant_info['number'] employee_info = info['employee'] employee_index = employee_info['start-point'] employee_amount = employee_info['number-each-tenant'] i = 0 while tenant_index < tenant_index_limit: tenant_name = tenant_name_prefix + str(tenant_index) driver = log_in(account, tenant_name, url, driver) while i < employee_amount: employee_index = employee_index + i driver, result = create_employee(tenant_name, employee_index, employee_info, url, driver, result, need_create_employee) i += 1 driver = log_out(url, driver) i = 0 tenant_index += 1 employee_index += 1 return driver, result
def create_tenants(account, info, url, driver, result, need_create_tenant=False): tenant = info['tenant'] tenant_name_prefix = tenant['name'] driver = log_in(account, account['tenant'], url, driver) tenant_index = tenant['start-point'] tenant_index_limit = tenant_index + tenant['number'] while tenant_index < tenant_index_limit: current_tenant = { 'name': tenant_name_prefix + str(tenant_index), 'source_schema': tenant['source_schema'] } tenant = generate_tenant_info(current_tenant, info['base']) driver, result = create_tenant(tenant, url, driver, result, need_create_tenant) tenant_index += 1 driver = log_out(url, driver) return driver, result
def login_page_login_command(self): print(threading.get_ident()) print(self.thread_id) if self.thread_id != threading.get_ident(): error_box.wrong_username() LoginPage(self.root) return # account.log_in(conn, login_page_username_entry.get(), login_page_password_entry.get()) user_info['acc'] = account.log_in(self.conn, self.login_page_username_entry.get(), self.login_page_password_entry.get()) if user_info['acc'] is not None: if account.account_has_characters(self.conn, user_info['acc'].id): CharacterSelectionPage(self.root) else: CharacterCreationPage(self.root)
from selenium import webdriver from account import log_in, log_out from employee import inactive_employee from info import load_config chrome_driver = webdriver.Chrome() admin_account = load_config("./account.json")['account']['admin'] employee_info = load_config("./employee.json")['employees'] url = load_config("./url.json")['url'] for employee in employee_info: chrome_driver = log_in(admin_account, employee['tenant'], url, chrome_driver) chrome_driver = inactive_employee(employee, url, chrome_driver, True) chrome_driver = log_out(url, chrome_driver) chrome_driver.close()
from selenium import webdriver from account import log_in, log_out from info import load_config from tenant import create_tenant, generate_tenant_info chrome_driver = webdriver.Chrome() admin_account = load_config("./account.json")['account']['admin'] copy_info = load_config("./copy.json")['copy'] url = load_config("./url.json")['url'] for tenant in copy_info['tenants']: chrome_driver = log_in(admin_account, admin_account['tenant'], url, chrome_driver) tenant = generate_tenant_info(tenant, copy_info['base']) chrome_driver = create_tenant(tenant, url, chrome_driver, True) chrome_driver = log_out(url, chrome_driver) chrome_driver.close()