示例#1
0
def get_line_list_entry(search_number):
    line_tr = common.get_line(search_number)
    device_img = line_tr.find_element_by_class_name("col_identity").find_elements_by_tag_name("img")[1]
    device = "phone-green" in device_img.get_attribute("src")
    protocol = line_tr.find_element_by_class_name("col_protocol").text.lower()
    user = line_tr.find_element_by_class_name("col_user").text
    number = line_tr.find_element_by_class_name("col_number").text
    return {"device": device, "protocol": protocol, "user": user, "number": number}
示例#2
0
def uninstall_plugins(plugin_name):
    common.open_url('provd_plugin')
    # uninstalling more than 1 plugins can't done in one step or selenium will raise a StaleElementReferenceException
    plugin_names = []
    for plugin_line in common.find_lines(plugin_name):
        plugin_names.append(plugin_line.find_element_by_xpath('.//td[2]').text)
    for plugin_name in plugin_names:
        plugin_line = common.get_line(plugin_name)
        _uninstall_plugin(plugin_line)
示例#3
0
def then_i_see_errors(step, profile_label):
    common.open_url('profile', 'list')
    table_line = common.get_line(profile_label)
    try:
        table_line.find_element_by_xpath(".//a[@title='Delete']")
    except NoSuchElementException:
        pass
    else:
        raise Exception('CTI profile %s should not be removable' % profile_label)
示例#4
0
def uninstall_plugins(plugin_name):
    common.open_url('provd_plugin')
    # uninstalling more than 1 plugins can't done in one step or selenium will raise a StaleElementReferenceException
    plugin_names = []
    for plugin_line in common.find_lines(plugin_name):
        plugin_names.append(plugin_line.find_element_by_xpath('.//td[2]').text)
    for plugin_name in plugin_names:
        plugin_line = common.get_line(plugin_name)
        _uninstall_plugin(plugin_line)
示例#5
0
def then_i_see_errors(step, profile_label):
    common.open_url('profile', 'list')
    table_line = common.get_line(profile_label)
    try:
        table_line.find_element_by_xpath(".//a[@title='Delete']")
    except NoSuchElementException:
        pass
    else:
        raise Exception('CTI profile %s should not be removable' %
                        profile_label)
示例#6
0
def get_user_list_entry(search_fullname):
    user_tr = common.get_line(search_fullname)
    fullname = user_tr.find_element_by_class_name('col_fullname').text
    provisioning_code = user_tr.find_element_by_class_name('col_provisioning_code').text
    number = user_tr.find_element_by_class_name('col_number').text
    protocol = user_tr.find_element_by_class_name('col_protocol').text
    return {
        'fullname': fullname,
        'provisioning_code': provisioning_code,
        'number': number,
        'protocol': protocol
    }
示例#7
0
def get_user_list_entry(search_fullname):
    user_tr = common.get_line(search_fullname)
    fullname = user_tr.find_element_by_class_name('col_fullname').text
    provisioning_code = user_tr.find_element_by_class_name(
        'col_provisioning_code').text
    number = user_tr.find_element_by_class_name('col_number').text
    protocol = user_tr.find_element_by_class_name('col_protocol').text
    return {
        'fullname': fullname,
        'provisioning_code': provisioning_code,
        'number': number,
        'protocol': protocol
    }
示例#8
0
def get_line_list_entry(search_number):
    line_tr = common.get_line(search_number)
    device_img = line_tr.find_element_by_class_name(
        'col_identity').find_elements_by_tag_name('img')[1]
    device = 'phone-green' in device_img.get_attribute('src')
    protocol = line_tr.find_element_by_class_name('col_protocol').text.lower()
    user = line_tr.find_element_by_class_name('col_user').text
    number = line_tr.find_element_by_class_name('col_number').text
    return {
        'device': device,
        'protocol': protocol,
        'user': user,
        'number': number,
    }
示例#9
0
def set_privileges(username, privileges):
    common.open_url('admin_user', 'list')

    line = common.get_line(username)
    acl_button = line.find_element_by_xpath(".//a[@title='Rules']")
    acl_button.click()

    categories = set((x['module'], x['category']) for x in privileges)
    for module, category in categories:
        open_category(module, category)

    for privilege in privileges:
        set_privilege(privilege)

    form.submit.submit_form()
示例#10
0
def set_privileges(username, privileges):
    common.open_url('admin_user', 'list')

    line = common.get_line(username)
    acl_button = line.find_element_by_xpath(".//a[@title='Rules']")
    acl_button.click()

    categories = set((x['module'], x['category']) for x in privileges)
    for module, category in categories:
        open_category(module, category)

    for privilege in privileges:
        set_privilege(privilege)

    form.submit.submit_form()
示例#11
0
def get_nb_agents_in_group(agent_group):
    common.open_url('agent', 'list')
    table_line = common.get_line(agent_group)
    nb_agent = int(table_line.find_element_by_xpath(".//td[3]").text)
    return nb_agent
示例#12
0
def get_agent_group_id(agent_group):
    common.open_url('agent', 'list')
    table_line = common.get_line(agent_group)
    agent_group_id = int(table_line.find_element_by_xpath(".//input[@name='agentgroups[]']").get_attribute('value'))
    return agent_group_id
示例#13
0
def go_to_agent_group_page_list(agent_group):
    common.open_url('agent', 'list')
    table_line = common.get_line(agent_group)
    url_agent_group = table_line.find_element_by_xpath(".//a[@title='%s']" % agent_group)
    url_agent_group.click()
示例#14
0
def select_agent_group_list(agent_group_list):
    for agent_group in agent_group_list:
        table_line = common.get_line(agent_group.strip())
        element = table_line.find_element_by_xpath(".//input[@name='agentgroups[]']")
        element.click()
示例#15
0
def when_i_download_backup_file(step, filename):
    common.open_url('backups')
    table_line = common.get_line(filename)
    download_link = table_line.find_element_by_xpath(".//a[@title='%s']" % filename)
    download_link.click()
示例#16
0
def then_the_directory_has_the_uri(step, directory, uri):
    line = common.get_line(directory)
    cells = line.find_elements_by_tag_name("td")
    uri_cell = cells[2]
    assert uri_cell.text == uri
示例#17
0
def _click_checkbox_for_line(extension):
    line_element = common.get_line(extension)
    checkbox = line_element.find_element_by_css_selector(".it-checkbox")
    checkbox.click()
示例#18
0
def then_the_directory_has_the_uri(step, directory, uri):
    line = common.get_line(directory)
    cells = line.find_elements_by_tag_name("td")
    uri_cell = cells[2]
    assert uri_cell.text == uri
示例#19
0
def get_agent_group_id(agent_group):
    common.open_url("agent", "list")
    table_line = common.get_line(agent_group)
    agent_group_id = int(table_line.find_element_by_xpath(".//input[@name='agentgroups[]']").get_attribute("value"))
    return agent_group_id
示例#20
0
def go_to_agent_group_page_list(agent_group):
    common.open_url("agent", "list")
    table_line = common.get_line(agent_group)
    url_agent_group = table_line.find_element_by_xpath(".//a[@title='%s']" % agent_group)
    url_agent_group.click()
示例#21
0
def install_plugin(plugin_name):
    common.open_url('provd_plugin')
    plugin_line = common.get_line(plugin_name)
    _install_plugin(plugin_line)
示例#22
0
def install_plugin(plugin_name):
    common.open_url('provd_plugin')
    plugin_line = common.get_line(plugin_name)
    _install_plugin(plugin_line)
示例#23
0
def select_agent_group_list(agent_group_list):
    for agent_group in agent_group_list:
        table_line = common.get_line(agent_group.strip())
        element = table_line.find_element_by_xpath(".//input[@name='agentgroups[]']")
        element.click()
示例#24
0
def get_nb_agents_in_group(agent_group):
    common.open_url("agent", "list")
    table_line = common.get_line(agent_group)
    nb_agent = int(table_line.find_element_by_xpath(".//td[3]").text)
    return nb_agent