def add_user(data_dict, step=None): user = User() if 'id' in data_dict: user.id = data_dict['id'] user.firstname = data_dict['firstname'] if 'lastname' in data_dict: user.lastname = data_dict['lastname'] if 'agentid' in data_dict: user.agent_id = int(data_dict['agentid']) if 'language' in data_dict: user.language = data_dict['language'] if 'enable_client' in data_dict: user.enable_client = bool(data_dict['enable_client']) if 'client_username' in data_dict: user.client_username = data_dict['client_username'] if 'client_password' in data_dict: user.client_password = data_dict['client_password'] if 'client_profile' in data_dict: user.client_profile = data_dict['client_profile'] if 'bsfilter' in data_dict: user.bsfilter = data_dict['bsfilter'] if 'entity_name' in data_dict: entity = entity_helper.get_entity_with_name(data_dict['entity_name']) if entity: user.entity_id = entity.id else: user.entity_id = entity_helper.oldest_entity_id() if 'line_number' in data_dict and 'line_context' in data_dict: user.line = UserLine() user.line.number = data_dict['line_number'] user.line.context = data_dict['line_context'] if 'protocol' in data_dict: user.line.protocol = data_dict['protocol'] if 'device' in data_dict: device = provd_helper.find_by_mac(data_dict['device']) if device is not None: user.line.device_id = str(device['id']) if 'voicemail_name' in data_dict and 'voicemail_number' in data_dict: user.voicemail = UserVoicemail() user.voicemail.name = data_dict['voicemail_name'] user.voicemail.number = data_dict['voicemail_number'] if 'mobile_number' in data_dict: user.mobile_number = data_dict['mobile_number'] try: ret = world.ws.users.add(user) except WebServiceRequestError as e: raise Exception('Could not add user %s %s: %s' % (user.firstname, user.lastname, e)) if not ret: return False if step is not None: _register_and_track_phone(step.scenario, data_dict) return int(ret)
def when_i_edit_the_device_with_mac_group1_using_no_parameters(step, mac): device = provd_helper.find_by_mac(mac) world.response = device_action_confd.edit_device(device['id'], {})
def when_i_edit_the_device_with_mac_group1_using_the_following_parameters(step, mac): device = provd_helper.find_by_mac(mac) parameters = step.hashes[0] world.response = device_action_confd.edit_device(device['id'], parameters)
def when_i_go_get_the_device_with_mac_group1_using_its_id(step, mac): device = provd_helper.find_by_mac(mac) world.response = device_action_confd.get_device(device['id'])
def when_i_edit_the_device_with_mac_group1_using_the_following_parameters( step, mac): device = provd_helper.find_by_mac(mac) parameters = step.hashes[0] world.response = device_action_restapi.edit_device(device['id'], parameters)
def when_i_edit_the_device_with_mac_group1_using_no_parameters(step, mac): device = provd_helper.find_by_mac(mac) world.response = device_action_restapi.edit_device(device['id'], {})
def when_i_go_get_the_device_with_mac_group1_using_its_id(step, mac): device = provd_helper.find_by_mac(mac) world.response = device_action_restapi.get_device(device['id'])