def test_skte_t1066_create_edit_delete_user(self): """ 该用例包含T1066,T1065, T1078,T1079. 测试步骤: 1. 创建用户 2. 查找新建用户 3. 编辑用户 4. 使用新用户创建多种任务 5. 删除用户 6. 检查共享任务是否存在 """ # 1.创建新用户 uuid = send_user_m_req.create_user(self.token, username=config.user_name_tmp, fullname=config.user_full_name_tmp, password=config.user_passwd_tmp) # 2. 查找新建用户 user_uuid = send_user_m_req.get_uuid_by_username( self.token, username=config.user_name_tmp) assert user_uuid == uuid # 3.编辑用户 user_update = send_user_m_req.edit_user(self.token, uuid, fullname='更新用户全名') assert user_update['fullName'] == '更新用户全名' # 4. 新用户登录创建多种任务 # TODO: 补充创建共享image,文件等项目 tmp_token = send_user_m_req.get_token_simple(config.user_name_tmp, config.user_passwd_tmp) users = send_user_m_req.get_uuid_list_by_users( token=tmp_token, users=[config.user_name_a]) send_project_m_req.create_project(tmp_token, project_name='T1079', users=users) # 5.删除新用户 send_user_m_req.delete_user(self.token, uuid=uuid) uuid = send_user_m_req.get_uuid_by_username( self.token, username=config.user_name_tmp) assert uuid == '' # 6. 使用被共享用户登录, 查看被删除用户共享任务是否存在 # TODO: 等待SDX功能完善, 修改判断条件 token = send_user_m_req.get_token_simple(config.user_name_a, config.user_passwd_a) project_list = send_project_m_req.get_project_list(token) if project_list['total'] > 0: items = project_list['data']['items'] for item in items: if item['owner'].get('username') == config.user_name_tmp: assert False assert True
def test_SKTE_T3596_create_and_delete_project_from_model(self): # 创建模板项目 uuid = send_project_m_req.create_project( self.token, project_name='T3596 model project ', is_template=True) # 基于模板项目创建项目 res = send_project_m_req.create_project(self.token, model_id=uuid) # 删除基于模板项目创建的项目 send_project_m_req.delete_project_by_uuid(self.token, res) # 删除模板项目 send_project_m_req.delete_project_by_uuid(self.token, uuid)
def test_SKTE_T3600_container_dev_task(self): # 因环境问题创建任务时报错,不能继续调试 # 获取image的uuid image_id = send_image_m_req.get_image_uuid_by_image_name( self.token, config.container_dev_tf114_py36_cpu_image) # 创建项目 project_id = send_project_m_req.create_project( self.token, project_name='project for SKTE_T3600') # 创建任务 task_uuid = send_project_m_req.create_project_task( self.token, task_name='container dev task', project_id=project_id, task_type='CONTAINER_DEV', image_id=image_id, resource_config=None) logger.log_debug('new task id is {}'.format(task_uuid)) # 启动任务 started_task_uuid = send_project_m_req.start_project_task( self.token, task_uuid) assert False if task_uuid != started_task_uuid else True # 查询任务状态 start_status = send_project_m_req.get_project_task_status_by_uuid( self.token, task_uuid) logger.log_debug( 'task status after starting is {}'.format(start_status))
def test_SKTE_T3712_create_and_delete_collaborative_project(self): # 创建协作项目 uuid = send_user_m_req.get_uuid_by_username( self.token, config.collaborative_user) # 获取协作用户uuid joint_id = [] joint_id.append(uuid) res = send_project_m_req.create_project( self.token, project_name='T3712 auto test collaborative project', users=joint_id) # 获取协作项目uuid # 协作项目校验:协作用户可以进入协作项目页面,可以创建/删除、启停任务(任务部分待补充),不支持对协作项目进行写操作,如删除协作项目 joint_token = send_user_m_req.get_token_simple( config.collaborative_user, config.collaborative_userpwd) # 获取协作用户token send_project_m_req.entry_project_by_uuid(joint_token, res) # 协作用户可以进入协作项目页面 # send_project_m_req.delete_project_by_uuid(joint_token, res, '403') # 协作用户无权删除协作项目,实际测试不通过,可以通过接口删除 # 创建者删除协作项目 send_project_m_req.delete_project_by_uuid(self.token, res)
def test_SKTE_T2624_create_start_stop_delete_task_(self): # # 获取image的uuid image_id = send_image_m_req.get_image_uuid_by_image_name( self.token, config.jupyter_image_name) # 创建项目 project_id = send_project_m_req.create_project( self.token, project_name='auto test project 4 task') # 创建任务 task_uuid = send_project_m_req.create_project_task( self.token, task_name='automation task', project_id=project_id, task_type='JUPYTER', image_id=image_id, resource_config=None) logger.log_debug('new task id is {}'.format(task_uuid)) # 启动任务 started_task_uuid = send_project_m_req.start_project_task( self.token, task_uuid) assert False if task_uuid != started_task_uuid else True # 查询任务状态 start_status = send_project_m_req.get_project_task_status_by_uuid( self.token, task_uuid) logger.log_debug( 'task status after starting is {}'.format(start_status)) # 停止任务 send_project_m_req.stop_project_task(self.token, task_uuid) # 查询任务状态 stop_status = send_project_m_req.get_project_task_status_by_uuid( self.token, task_uuid) logger.log_debug( 'task status after stopping is {}'.format(stop_status)) # 删除任务 send_project_m_req.delete_project_task_by_uuid(self.token, task_uuid) # 删除项目 send_project_m_req.delete_project_by_uuid(self.token, project_id)
def test_SKTE_T2495_create_and_delete_empty_project(self): uuid = send_project_m_req.create_project( self.token, project_name='auto test project') send_project_m_req.delete_project_by_uuid(self.token, uuid)
def test_SKTE_T3595_create_and_delete_model_project(self): res = send_project_m_req.create_project( self.token, project_name='T3595 auto test model project ', is_template=True) send_project_m_req.delete_project_by_uuid(self.token, res)
def test_SKTE_T3594_create_and_delete_empty_project(self): res = send_project_m_req.create_project( self.token, project_name='T3594 auto test empty project') send_project_m_req.delete_project_by_uuid(self.token, res)