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.get_user_id_with_firstname_lastname(info['firstname'], info.get('lastname')) user_ids.append(user_id) group_helper.add_group(name, number, context, user_ids)
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 _delete_extension_type(exten, extension_type, typeval): try: if extension_type == 'user': user_helper.delete_user(int(typeval)) elif extension_type == 'queue': queue_helper.delete_queues_with_number(exten) elif extension_type == 'group': group_helper.delete_groups_with_number(exten) elif extension_type == 'incall': incall_helper.delete_incalls_with_did(exten) elif extension_type == 'meetme': meetme_helper.delete_meetme_with_confno(exten) elif extension_type == 'outcall': dialpattern_helper.delete((typeval)) except ElementDeletionError as e: print "I tried deleting a type %s typeval %s but it didn't work." % (extension_type, typeval) print e
def _delete_extension_type(exten, extension_type, typeval): try: if extension_type == 'user': user_helper.delete_user(int(typeval)) elif extension_type == 'queue': queue_helper.delete_queues_with_number(exten) elif extension_type == 'group': group_helper.delete_groups_with_number(exten) elif extension_type == 'incall': incall_helper.delete_incalls_with_did(exten) elif extension_type == 'meetme': meetme_helper.delete_meetme_with_confno(exten) elif extension_type == 'outcall': dialpattern_helper.delete((typeval)) except ElementDeletionError as e: print "I tried deleting a type %s typeval %s but it didn't work." % ( extension_type, typeval) print e
def given_there_are_groups(step): for group in step.hashes: group_helper.delete_groups_with_number(group['exten']) group_helper.add_group( group['name'], group['exten'], group['context'] ) common.open_url('group', 'list', {'search': group['name']}) common.edit_line(group['name']) if 'ring seconds' in group: form.input.set_text_field_with_label('Ring time', '%s' % group['ring seconds']) if 'noanswer' in group: common.go_to_tab('No answer') forward_dest_type, forward_dest_name = group['noanswer'].split(':', 1) if forward_dest_type == 'group': form.select.set_select_field_with_id('it-dialaction-noanswer-actiontype', 'Group') form.select.set_select_field_with_id_containing('it-dialaction-noanswer-group-actionarg1', forward_dest_name) form.submit.submit_form() common.open_url('group', 'list', {'search': ''})
def given_there_are_groups(step): for group in step.hashes: group_helper.delete_groups_with_number(group['exten']) group_helper.add_group(group['name'], group['exten'], group['context']) common.open_url('group', 'list', {'search': group['name']}) common.edit_line(group['name']) if 'ring seconds' in group: form.select.set_select_field_with_label( 'Ring time', '%s seconds' % group['ring seconds']) if 'noanswer' in group: common.go_to_tab('No answer') forward_dest_type, forward_dest_name = group['noanswer'].split( ':', 1) if forward_dest_type == 'group': form.select.set_select_field_with_id( 'it-dialaction-noanswer-actiontype', 'Group') form.select.set_select_field_with_id_containing( 'it-dialaction-noanswer-group-actionarg1', forward_dest_name) form.submit.submit_form() common.open_url('group', 'list', {'search': ''})
def given_there_is_a_group_with_extension(step, name, number, context): group_helper.delete_groups_with_number(number) group_helper.add_group(name, number, context)