def test_project_update_projectName_success(self): '''修改项目名称''' project_list = ProjectSelect().project_select(projectStatus='0',projectName=self.projectName).json()[ 'content'][ 'dataList'] if project_list != [] and len(project_list) == 1: for project in project_list: self.customerId = project['custId'] else: self.logger.error('Please check the results of the project for error') self.projectName_update = '修改项目' project_update_list = ProjectSelect().project_select(projectStatus='0', projectName=self.projectName_update).json()[ 'content']['dataList'] if project_update_list != [] and len(project_update_list) == 1: sql = 'DELETE FROM YD_TMS_PROJECT WHERE projectName = \'{0}\'and partnerNo = \'{1}\''.format( self.projectName_update, self.config['partnerNo']) self.DBUtil = DBUtil(host=self.config['db_host'], port=self.config['db_port'], user=self.config['db_user'], passwd=self.config['db_passwd'], dbname=self.config['db_dbname'], charset=self.config['db_charset']) self.DBUtil.execute_sql(sql) else: self.logger.error('Please check the results of the project for error') response = ProjectUpdate().project_update(projectId=self.projectId,updateType='1', projectName=self.projectName_update,custId=self.customerId, startTime =self.startTime,endTime=self.endTime) self.logger.info('修改项目名称返回状态码:{0}'.format(response)) self.assertEqual(response.status_code, 200) self.assertEqual(response.json()['code'], 0) self.logger.info('修改项目名称返回:{0}'.format(response.json())) response_get = ProjectGet().project_get(self.projectId) self.assertEqual(self.projectName_update, response_get.json()['content']['projectName'], 'Project updated fail!')
def project_data_permission_choice(self): project_list = ProjectSelect().project_select( rows='1000', projectStatus='1').json()['content']['dataList'] if project_list == []: projectId = '' self.logger.info('项目数据权限选择不限') else: project = random.sample(project_list, 1)[0] projectId = project['projectId'] self.logger.info('项目数据权限选择: {0}'.format(project['projectName'])) return projectId
def project_choice(projectName='德邦物流', customerName='德邦集团', customerCode='DB20171101100', phone='13077327043', customerDeveloper='张经理'): project_list = ProjectSelect().project_select(rows='1000', projectStatus='1').json()['content']['dataList'] if project_list == []: startTime = time.strftime('%Y-%m-%d') endTime = time.strftime('%Y-%m-%d', time.localtime(time.time() + 2592000)) projectId = CreateProject().create_project(projectName, startTime, endTime, customerName, customerCode, phone, customerDeveloper) project = {'projectId': projectId, 'projectName': projectName} CreateLine.my_print('新建的项目是: {0}'.format(project)) else: project = random.sample(project_list, 1)[0] CreateLine.my_print('选择的项目是: {0}'.format(project)) return project
def test_project_create_success(self): '''新增项目''' CreateProject().create_project(self.projectName, self.startTime, self.endTime, self.customerName, self.customerCode, self.phone, '黄经理') project_list = ProjectSelect().project_select( projectName=self.projectName, projectStatus='0').json()['content']['dataList'] if project_list != []: L = [] for project in project_list: L.append(str(project['projectName'])) self.assertIn(self.projectName, L, 'project created fail!') else: self.logger.error( 'Please check the results of the project for empty')
def project_one_choice(projectName, startTime, endTime, customerName, customerCode, phone, customerDeveloper): project_list = ProjectSelect().project_select( rows='1000', projectStatus='1').json()['content']['dataList'] if project_list != []: L = [] for project in project_list: if project['projectName'] == projectName: L.append(project['projectName']) return project if len(L) == 0: projectId = CreateProject().create_project( projectName, startTime, endTime, customerName, customerCode, phone, customerDeveloper) project = {'projectId': projectId, 'projectName': projectName} return project else: projectId = CreateProject().create_project(projectName, startTime, endTime, customerName, customerCode, phone, customerDeveloper) project = {'projectId': projectId, 'projectName': projectName} return project