def when_i_edit_voicemail_via_restapi(step, extension): parameters = _extract_voicemail_info_to_restapi(step.hashes[0]) number, context = func.extract_number_and_context_from_extension(extension) voicemail_id = voicemail_helper.find_voicemail_id_with_number( number, context) world.response = voicemail_action_restapi.edit_voicemail( voicemail_id, parameters)
def when_i_link_user_group1_with_voicemail_group2_via_restapi( step, fullname, voicemail): user = user_helper.find_user_by_name(fullname) number, context = func.extract_number_and_context_from_extension(voicemail) voicemail_id = voicemail_helper.find_voicemail_id_with_number( number, context) world.response = voicemail_link_action_restapi.link_voicemail( user.id, voicemail_id)
def given_there_is_a_group_with_extension_and_users(step, name, extension): number, context = func.extract_number_and_context_from_extension(extension) group_helper.delete_groups_with_number(number) user_ids = [] for info in step.hashes: user_id = user_helper.find_user_id_with_firstname_lastname(info['firstname'], info['lastname']) user_ids.append(user_id) group_helper.add_group(name, number, context, user_ids)
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)
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)
def given_there_is_a_group_with_extension_and_users(step, name, extension): number, context = func.extract_number_and_context_from_extension(extension) group_helper.delete_groups_with_number(number) user_ids = [] for info in step.hashes: user_id = user_helper.find_user_id_with_firstname_lastname( info['firstname'], info['lastname']) user_ids.append(user_id) group_helper.add_group(name, number, context, user_ids)
def when_i_edit_voicemail_via_restapi(step, extension): parameters = _extract_voicemail_info_to_restapi(step.hashes[0]) number, context = func.extract_number_and_context_from_extension(extension) voicemail_id = voicemail_helper.find_voicemail_id_with_number(number, context) world.response = voicemail_action_restapi.edit_voicemail(voicemail_id, parameters)
def when_i_send_a_request_for_the_voicemail_with_number_group1_using_its_id(step, extension): number, context = func.extract_number_and_context_from_extension(extension) voicemail_id = voicemail_helper.find_voicemail_id_with_number(number, context) world.response = voicemail_action_restapi.get_voicemail(voicemail_id)
def when_chan_test_calls_with_id_calleridname_calleridnum(step, extension, channelid, calleridname, calleridnum): number, context = func.extract_number_and_context_from_extension(extension) cmd = "test newid %s %s %s %s %s" % (channelid, number, context, calleridnum, calleridname) asterisk_helper.send_to_asterisk_cli(cmd)
def when_chan_test_calls(step, extension): number, context = func.extract_number_and_context_from_extension(extension) cmd = 'test new %s %s' % (number, context) asterisk_helper.send_to_asterisk_cli(cmd)
def find_with_extension(extension): number, context = func.extract_number_and_context_from_extension(extension) return find_with_exten_context(number, context)
def find_with_extension(extension): number, context = func.extract_number_and_context_from_extension(extension) return find_with_exten_context(number, context)
def when_i_delete_voicemail_with_number_group1_via_restapi(step, extension): number, context = func.extract_number_and_context_from_extension(extension) voicemail_id = voicemail_helper.find_voicemail_id_with_number( number, context) world.response = voicemail_action_restapi.delete_voicemail(voicemail_id)
def when_i_send_a_request_for_the_voicemail_with_number_group1_using_its_id( step, extension): number, context = func.extract_number_and_context_from_extension(extension) voicemail_id = voicemail_helper.find_voicemail_id_with_number( number, context) world.response = voicemail_action_restapi.get_voicemail(voicemail_id)
def when_i_delete_voicemail_with_number_group1_via_restapi(step, extension): number, context = func.extract_number_and_context_from_extension(extension) voicemail_id = voicemail_helper.find_voicemail_id_with_number(number, context) world.response = voicemail_action_restapi.delete_voicemail(voicemail_id)
def when_i_link_user_group1_with_voicemail_group2_via_restapi(step, fullname, voicemail): user = user_helper.find_user_by_name(fullname) number, context = func.extract_number_and_context_from_extension(voicemail) voicemail_id = voicemail_helper.find_voicemail_id_with_number(number, context) world.response = voicemail_link_action_restapi.link_voicemail(user.id, voicemail_id)
def then_line_with_number_exists(step, extension): number, context = func.extract_number_and_context_from_extension(extension) assert line_helper.is_with_exten_context_exists(number, context)
def then_line_with_number_exists_with_password(step, extension, password): number, context = func.extract_number_and_context_from_extension(extension) line = line_helper.find_with_exten_context(number, context) assert line assert line.secret == password
def then_i_see_rejected_call_in_asterisk_log(step, extension): number, context = func.extract_number_and_context_from_extension(extension) expression = "to extension '%s' rejected because extension not found in context '%s'" % (number, context) assert search_str_in_asterisk_log(expression)
def then_i_see_rejected_call_in_asterisk_log(step, extension): number, context = func.extract_number_and_context_from_extension(extension) expression = "to extension '%s' rejected because extension not found in context '%s'" % ( number, context) assert search_str_in_asterisk_log(expression)
def when_chan_test_calls(step, extension): number, context = func.extract_number_and_context_from_extension(extension) cmd = "test new %s %s" % (number, context) asterisk_helper.send_to_asterisk_cli(cmd)
def when_chan_test_calls_with_id_calleridname_calleridnum( step, extension, channelid, calleridname, calleridnum): number, context = func.extract_number_and_context_from_extension(extension) cmd = 'test newid %s %s %s %s %s' % (channelid, number, context, calleridnum, calleridname) asterisk_helper.send_to_asterisk_cli(cmd)
def when_i_associate_a_fake_user_with_with_voicemail_group1_via_confd(step, voicemail): number, context = func.extract_number_and_context_from_extension(voicemail) voicemail_id = voicemail_helper.find_voicemail_id_with_number(number, context) world.response = voicemail_link_action_confd.link_voicemail(FAKE_ID, voicemail_id)