Exemplo n.º 1
0
def when_i_create_an_agent_in_group(step, firstname, lastname, number,
                                    agent_group):
    agent_helper.delete_agents_with_number(number)
    group_id = agent_action_webi.get_agent_group_id(agent_group)
    common.open_url('agent', 'addagent', {'group': group_id})
    agent_action_webi.type_agent_info(firstname, lastname, number)
    form.submit.submit_form()
Exemplo n.º 2
0
def _add_user(user_data, step=None):
    user_ws_data = {}
    user_ws_data['firstname'] = user_data['firstname']
    user_ws_data['lastname'] = user_data['lastname']

    if user_data.get('entity_name'):
        user_ws_data['entity_name'] = user_data['entity_name']

    if user_data.get('number') and user_data.get('context'):
        user_ws_data['line_number'] = user_data['number']
        user_ws_data['line_context'] = user_data['context']
        if 'protocol' in user_data:
            user_ws_data['protocol'] = user_data['protocol']
        if 'device' in user_data:
            user_ws_data['device'] = user_data['device']

        if user_data.get('voicemail_name') and user_data.get('voicemail_number'):
            user_ws_data['voicemail_name'] = user_data['voicemail_name']
            user_ws_data['voicemail_number'] = user_data['voicemail_number']

    if user_data.get('bsfilter'):
        user_ws_data['bsfilter'] = user_data['bsfilter']

    if user_data.get('language'):
        user_ws_data['language'] = user_data['language']

    if 'voicemail_name' in user_data and 'language' not in user_data:
        user_ws_data['language'] = 'en_US'

    if user_data.get('cti_profile'):
        user_ws_data['enable_client'] = True
        user_ws_data['client_profile'] = user_data['cti_profile']
        if user_data.get('cti_login'):
            user_ws_data['client_username'] = user_data['cti_login']
        else:
            user_ws_data['client_username'] = user_ws_data['firstname'].lower()
        if user_data.get('cti_passwd'):
            user_ws_data['client_password'] = user_data['cti_passwd']
        else:
            user_ws_data['client_password'] = user_ws_data['lastname'].lower()

    if user_data.get('mobile_number'):
        user_ws_data['mobile_number'] = user_data['mobile_number']

    user_id = ule_helper.add_or_replace_user(user_ws_data, step=step)

    if user_data.get('agent_number'):
        agent_helper.delete_agents_with_number(user_data['agent_number'])
        agent_data = {'firstname': user_data['firstname'],
                      'lastname': user_data['lastname'],
                      'number': user_data['agent_number'],
                      'context': user_data.get('context', 'default'),
                      'users': [int(user_id)]}
        agent_helper.add_agent(agent_data)

    if user_data.get('group_name'):
        group_helper.add_or_replace_group(user_data['group_name'], user_ids=[user_id])
Exemplo n.º 3
0
def given_there_is_a_agent_in_context_with_number(step, firstname, lastname, extension):
    number, context = func.extract_number_and_context_from_extension(extension)
    agent_helper.delete_agents_with_number(number)
    agent_data = {
        'firstname': firstname,
        'lastname': lastname,
        'number': number,
        'context': context
    }
    agent_helper.add_agent(agent_data)
Exemplo n.º 4
0
def given_there_is_a_agent_in_context_with_number(step, firstname, lastname,
                                                  extension):
    number, context = func.extract_number_and_context_from_extension(extension)
    agent_helper.delete_agents_with_number(number)
    agent_data = {
        'firstname': firstname,
        'lastname': lastname,
        'number': number,
        'context': context
    }
    agent_helper.add_agent(agent_data)
Exemplo n.º 5
0
def _add_user(user_data, step=None):
    user_ws_data = {}
    user_ws_data['firstname'] = user_data['firstname']
    user_ws_data['lastname'] = user_data['lastname']

    if user_data.get('entity_name'):
        user_ws_data['entity_name'] = user_data['entity_name']

    if user_data.get('number') and user_data.get('context'):
        user_ws_data['line_number'] = user_data['number']
        user_ws_data['line_context'] = user_data['context']
        if 'protocol' in user_data:
            user_ws_data['protocol'] = user_data['protocol']
        if 'device' in user_data:
            user_ws_data['device'] = user_data['device']

        if user_data.get('voicemail_name') and user_data.get(
                'voicemail_number'):
            user_ws_data['voicemail_name'] = user_data['voicemail_name']
            user_ws_data['voicemail_number'] = user_data['voicemail_number']

    if user_data.get('bsfilter'):
        user_ws_data['bsfilter'] = user_data['bsfilter']

    if user_data.get('language'):
        user_ws_data['language'] = user_data['language']

    if 'voicemail_name' in user_data and 'language' not in user_data:
        user_ws_data['language'] = 'en_US'

    if user_data.get('cti_profile'):
        user_ws_data['enable_client'] = True
        user_ws_data['client_profile'] = user_data['cti_profile']
        if user_data.get('cti_login'):
            user_ws_data['client_username'] = user_data['cti_login']
        else:
            user_ws_data['client_username'] = user_ws_data['firstname'].lower()
        if user_data.get('cti_passwd'):
            user_ws_data['client_password'] = user_data['cti_passwd']
        else:
            user_ws_data['client_password'] = user_ws_data['lastname'].lower()

    if user_data.get('mobile_number'):
        user_ws_data['mobile_number'] = user_data['mobile_number']

    user_id = ule_helper.add_or_replace_user(user_ws_data, step=step)

    if user_data.get('agent_number'):
        agent_helper.delete_agents_with_number(user_data['agent_number'])
        agent_data = {
            'firstname': user_data['firstname'],
            'lastname': user_data['lastname'],
            'number': user_data['agent_number'],
            'context': user_data.get('context', 'default'),
            'users': [int(user_id)]
        }
        agent_helper.add_agent(agent_data)

    if user_data.get('group_name'):
        group_helper.add_or_replace_group(user_data['group_name'],
                                          user_ids=[user_id])
Exemplo n.º 6
0
def when_i_create_an_agent_in_group(step, firstname, lastname, number, agent_group):
    agent_helper.delete_agents_with_number(number)
    group_id = agent_action_webi.get_agent_group_id(agent_group)
    common.open_url('agent', 'addagent', {'group': group_id})
    agent_action_webi.type_agent_info(firstname, lastname, number)
    form.submit.submit_form()
Exemplo n.º 7
0
def when_i_create_an_agent(step, firstname, lastname, number):
    agent_helper.delete_agents_with_number(number)
    common.open_url('agent', 'addagent', {'group': '1'})
    agent_action_webi.type_agent_info(firstname, lastname, number)
    form.submit.submit_form()
Exemplo n.º 8
0
def when_i_create_an_agent(step, firstname, lastname, number):
    agent_helper.delete_agents_with_number(number)
    common.open_url('agent', 'addagent', {'group': '1'})
    agent_action_webi.type_agent_info(firstname, lastname, number)
    form.submit.submit_form()