def test005_target_screen_mapping(self): func_name = sys._getframe().f_code.co_name csurl, method, headers, yamlvalue, yaml_path, mainkey = get_common_params('mapping.yaml', func_name) a = RestClient(rooturl) url = csurl + '756585727382392833' res = a.request(url=url, method=method, headers=headers) check_codes_msg(res, yamlvalue, mainkey)
def delete_datas(self,module_name,id): func_name = sys._getframe().f_code.co_name csurl, method, headers, yamlvalue, yaml_path, mainkey = get_common_params('merge.yaml', func_name) a = RestClient(rooturl) csurl = f'{csurl}/{module_name}/{id}' res = a.request(url=csurl, method=method, headers=headers) check_codes_msg(res, yamlvalue, mainkey)
def test009_add_target_condition(self): func_name = sys._getframe().f_code.co_name csurl, method, headers, yamlvalue, yaml_path, mainkey = get_common_params('merge.yaml', func_name) a = RestClient(rooturl) res = a.request(url=csurl, method=method, json=yamlvalue['data'], headers=headers) check_codes_msg(res, yamlvalue, mainkey) check_datas(res, yamlvalue)
def test011_merge_result(self): func_name = sys._getframe().f_code.co_name csurl, method, headers, yamlvalue, yaml_path, mainkey = get_common_params('merge.yaml', func_name) a = RestClient(rooturl) res = a.request(url=csurl, method=method, json=yamlvalue['data'], headers=headers) check_codes_msg(res, yamlvalue, mainkey) pytest.assume('"yihuikuanjine":"77"' in res.text)
def test002_create_work_flow(self): func_name = sys._getframe().f_code.co_name csurl, method, headers, yamlvalue, yaml_path, mainkey = get_common_params('process_manage.yaml', func_name) data={"procDef":{"procDefId":None,"bpmnXml":"<definitions xmlns=\"http://www.omg.org/spec/BPMN/20100524/MODEL\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:flowable=\"http://flowable.org/bpmn\" xmlns:bpmndi=\"http://www.omg.org/spec/BPMN/20100524/DI\" xmlns:omgdc=\"http://www.omg.org/spec/DD/20100524/DC\" xmlns:omgdi=\"http://www.omg.org/spec/DD/20100524/DI\" typeLanguage=\"http://www.w3.org/2001/XMLSchema\" expressionLanguage=\"http://www.w3.org/1999/XPath\" targetNamespace=\"http://www.flowable.org/processdef\"><process id=\"flowable-1601172398382\" name=\"work_flow\" isExecutable=\"true\"><extensionElements/><startEvent id=\"node-start\" name=\"开始\" flowable:initiator=\"starter\"></startEvent><endEvent id=\"node-end\" name=\"结束\"></endEvent><userTask id=\"input-9f2f8cd8\" name=\"node\" flowable:formKey=\"756585727382392834\" flowable:candidateGroups=\"r_756585370497454081\"><extensionElements></extensionElements></userTask><sequenceFlow id=\"line-f9aacee4\" sourceRef=\"node-start\" targetRef=\"input-9f2f8cd8\"></sequenceFlow><sequenceFlow id=\"line-9ca1f0f1\" sourceRef=\"input-9f2f8cd8\" targetRef=\"node-end\"></sequenceFlow></process><bpmndi:BPMNDiagram id=\"BPMNDiagram_flowable-1601172398382\"><bpmndi:BPMNPlane bpmnElement=\"flowable-1601172398382\" id=\"BPMNPlane_flowable-1601172398382\"><bpmndi:BPMNShape bpmnElement=\"input-9f2f8cd8\" id=\"BPMNShape_input-9f2f8cd8\"><omgdc:Bounds height=\"35\" width=\"60\" x=\"216.015625\" y=\"75\"></omgdc:Bounds></bpmndi:BPMNShape><bpmndi:BPMNShape bpmnElement=\"node-start\" id=\"BPMNShape_node-start\"><omgdc:Bounds height=\"50\" width=\"50\" x=\"50\" y=\"50\"></omgdc:Bounds></bpmndi:BPMNShape><bpmndi:BPMNShape bpmnElement=\"node-end\" id=\"BPMNShape_node-end\"><omgdc:Bounds height=\"50\" width=\"50\" x=\"650\" y=\"480\"></omgdc:Bounds></bpmndi:BPMNShape><bpmndi:BPMNEdge bpmnElement=\"line-f9aacee4\" id=\"BPMNEdge_line-f9aacee4\"><omgdi:waypoint x=\"0\" y=\"0\"></omgdi:waypoint><omgdi:waypoint x=\"0\" y=\"0\"></omgdi:waypoint></bpmndi:BPMNEdge><bpmndi:BPMNEdge bpmnElement=\"line-9ca1f0f1\" id=\"BPMNEdge_line-9ca1f0f1\"><omgdi:waypoint x=\"0\" y=\"0\"></omgdi:waypoint><omgdi:waypoint x=\"0\" y=\"0\"></omgdi:waypoint></bpmndi:BPMNEdge></bpmndi:BPMNPlane></bpmndi:BPMNDiagram></definitions>","formId":"756585727382392834","name":"work_flow","ruleCyclePeriod":"","ruleCycleTime":"undefined undefined * * ?","ruleType":0,"status":0,"type":1,"pushFlag":0},"procNodes":[{"isBack":0,"assignee":"756585370497454081","assigneeType":5,"formId":"756585727382392834","name":"node","formLayoutCode":"edit","pushMsg":0,"taskDefKey":"input-9f2f8cd8","id":"","sequence":0}],"procMsg":{"assignee":"","assigneeType":0}} a = RestClient(rooturl) res = a.request(url=csurl, method=method, json=data, headers=headers) check_codes_msg(res, yamlvalue, mainkey) check_datas(res, yamlvalue)
def test010_screen_status_active(self): func_name = sys._getframe().f_code.co_name csurl, method, headers, yamlvalue, yaml_path, mainkey = get_common_params('process_manage.yaml', func_name) a = RestClient(rooturl) res = a.request(url=csurl, method=method, headers=headers) check_codes_msg(res, yamlvalue, mainkey) pytest.assume('approval_flow' in res.text) pytest.assume('work_flow' in res.text)
def test006_change_phone_number(self): func_name = sys._getframe().f_code.co_name csurl, method, headers, yamlvalue, yaml_path, mainkey = get_common_params( 'personal_center.yaml', func_name) r = RestClient(rooturl) res = r.request(csurl, method, headers=headers) check_codes_msg(res, yamlvalue, mainkey) check_datas(res, yamlvalue)
def test005_modify_conpany_info(self): func_name = sys._getframe().f_code.co_name csurl, method, headers, yamlvalue, yaml_path, mainkey = get_common_params( 'personal_center.yaml', func_name) r = RestClient(rooturl) res = r.request(csurl, method, json=yamlvalue['data'], headers=headers) check_codes_msg(res, yamlvalue, mainkey) check_datas(res, yamlvalue)
def user_moduleid(is_login): """人员模块id查询""" rooturl = get_root_urls() csurl = '/apis/crm-web/module/find/module' a = RestClient(rooturl) head = {'access-token': is_login[0], 'refresh-token': is_login[1]} r = a.request(csurl, 'POST', headers=head) return json.loads(r.text)['data'][0]['id']
def test006_targetField_screen_mapping(self): func_name = sys._getframe().f_code.co_name csurl, method, headers, yamlvalue, yaml_path, mainkey = get_common_params('mapping.yaml', func_name) data= {"pageIndex":1,"pageSize":10,"sourceModuleId":"756585727382392832","sourceFieldId":"756585730700087298"} a = RestClient(rooturl) res = a.request(url=csurl, method=method, json=data, headers=headers) check_codes_msg(res, yamlvalue, mainkey) check_datas(res, yamlvalue)
def test013_delete_approval_flow(self): func_name = sys._getframe().f_code.co_name id, procDefId = Test_process_manage.search_process(self, name='approval_flow') csurl, method, headers, yamlvalue, yaml_path, mainkey = get_common_params('process_manage.yaml', func_name) a = RestClient(rooturl) csurl=csurl+id res = a.request(url=csurl, method=method, headers=headers) check_codes_msg(res, yamlvalue, mainkey) check_datas(res, yamlvalue)
def test003_modify_password(self): # 传入用例名称获取yaml数据字典 func_name = sys._getframe().f_code.co_name csurl, method, headers, yamlvalue, yaml_path, mainkey = get_common_params( 'personal_center.yaml', func_name) a = RestClient(rooturl) res = a.request(csurl, method, json=yamlvalue['data1'], headers=headers) check_codes_msg(res, yamlvalue, mainkey) # 调换新旧密码值,将密码改回 res = a.request(csurl, method, json=yamlvalue['data2'], headers=headers) check_codes_msg(res, yamlvalue, mainkey)
def test001_company_infor(self): func_name = sys._getframe().f_code.co_name csurl, method, headers, yamlvalue, yaml_path, mainkey = get_common_params( 'personal_center.yaml', func_name) a = RestClient(rooturl) res = a.request(url=csurl, method=method, headers=headers) print(res.text) check_codes_msg(res, yamlvalue, mainkey) check_datas(res, yamlvalue)
def test009_clean_all_notice(self): #该用例依赖test_set_notice_read008产生的notice数据,不可单独运行调试; func_name = sys._getframe().f_code.co_name csurl, method, headers, yamlvalue, yaml_path, mainkey = get_common_params( 'personal_center.yaml', func_name) r = RestClient(rooturl) res = r.request(csurl, method, headers=headers) check_codes_msg(res, yamlvalue, mainkey) check_datas(res, yamlvalue)
def test012_start_approval(self): func_name = sys._getframe().f_code.co_name approval_id, procDefId = Test_process_manage.search_process(self, name='approval_flow') csurl, method, headers, yamlvalue, yaml_path, mainkey = get_common_params('process_manage.yaml', func_name) a = RestClient(rooturl) url = csurl+str(procDefId)+'/start' res = a.request(url=url, method=method, json=yamlvalue['data'], headers=headers) check_codes_msg(res, yamlvalue, mainkey) check_datas(res, yamlvalue)
def test007_delete_mapping(self): func_name = sys._getframe().f_code.co_name csurl, method, headers, yamlvalue, yaml_path, mainkey = get_common_params('mapping.yaml', func_name) a = RestClient(rooturl) mapping_id = rd.load_yaml_value(yaml_path,'variable','mapping_id') url = csurl + mapping_id res = a.request(url=url, method=method, headers=headers) check_codes_msg(res, yamlvalue, mainkey) check_datas(res, yamlvalue)
def test004_screen_all(self): func_name = sys._getframe().f_code.co_name csurl, method, headers, yamlvalue, yaml_path, mainkey = get_common_params('process_manage.yaml', func_name) a = RestClient(rooturl) res = a.request(url=csurl, method=method, headers=headers) check_codes_msg(res, yamlvalue, mainkey) response_str = str(res.text) for d in yamlvalue['expectresult']['data']: pytest.assume(d in response_str)
def test001_create_approval_flow(self): func_name = sys._getframe().f_code.co_name csurl, method, headers, yamlvalue, yaml_path, mainkey = get_common_params('process_manage.yaml', func_name) data={"procDef":{"procDefId":None,"bpmnXml":"<definitions xmlns=\"http://www.omg.org/spec/BPMN/20100524/MODEL\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:flowable=\"http://flowable.org/bpmn\" xmlns:bpmndi=\"http://www.omg.org/spec/BPMN/20100524/DI\" xmlns:omgdc=\"http://www.omg.org/spec/DD/20100524/DC\" xmlns:omgdi=\"http://www.omg.org/spec/DD/20100524/DI\" typeLanguage=\"http://www.w3.org/2001/XMLSchema\" expressionLanguage=\"http://www.w3.org/1999/XPath\" targetNamespace=\"http://www.flowable.org/processdef\"><process id=\"flowable-1602297919597\" name=\"approval_flow\" isExecutable=\"true\"><extensionElements/><startEvent id=\"node-start\" name=\"开始\" flowable:initiator=\"starter\"></startEvent><endEvent id=\"node-end\" name=\"结束\"></endEvent><userTask id=\"review-252a859f\" name=\"review\" flowable:formKey=\"\" flowable:candidateGroups=\"u_756574317326995456\"><extensionElements></extensionElements></userTask><userTask id=\"input-97814ba8\" name=\"node\" flowable:formKey=\"\"><extensionElements></extensionElements></userTask><sequenceFlow id=\"line-b0c73353\" sourceRef=\"node-start\" targetRef=\"input-97814ba8\"></sequenceFlow><sequenceFlow id=\"line-406f5e6d\" sourceRef=\"input-97814ba8\" targetRef=\"review-252a859f\"></sequenceFlow><sequenceFlow id=\"line-7a5fc671\" sourceRef=\"review-252a859f\" targetRef=\"node-end\"></sequenceFlow></process><bpmndi:BPMNDiagram id=\"BPMNDiagram_flowable-1602297919597\"><bpmndi:BPMNPlane bpmnElement=\"flowable-1602297919597\" id=\"BPMNPlane_flowable-1602297919597\"><bpmndi:BPMNShape bpmnElement=\"review-252a859f\" id=\"BPMNShape_review-252a859f\"><omgdc:Bounds height=\"40\" width=\"60\" x=\"385.015625\" y=\"116.5\"></omgdc:Bounds></bpmndi:BPMNShape><bpmndi:BPMNShape bpmnElement=\"input-97814ba8\" id=\"BPMNShape_input-97814ba8\"><omgdc:Bounds height=\"35\" width=\"60\" x=\"225.515625\" y=\"95.5\"></omgdc:Bounds></bpmndi:BPMNShape><bpmndi:BPMNShape bpmnElement=\"node-start\" id=\"BPMNShape_node-start\"><omgdc:Bounds height=\"50\" width=\"50\" x=\"50\" y=\"50\"></omgdc:Bounds></bpmndi:BPMNShape><bpmndi:BPMNShape bpmnElement=\"node-end\" id=\"BPMNShape_node-end\"><omgdc:Bounds height=\"50\" width=\"50\" x=\"650\" y=\"480\"></omgdc:Bounds></bpmndi:BPMNShape><bpmndi:BPMNEdge bpmnElement=\"line-b0c73353\" id=\"BPMNEdge_line-b0c73353\"><omgdi:waypoint x=\"0\" y=\"0\"></omgdi:waypoint><omgdi:waypoint x=\"0\" y=\"0\"></omgdi:waypoint></bpmndi:BPMNEdge><bpmndi:BPMNEdge bpmnElement=\"line-406f5e6d\" id=\"BPMNEdge_line-406f5e6d\"><omgdi:waypoint x=\"0\" y=\"0\"></omgdi:waypoint><omgdi:waypoint x=\"0\" y=\"0\"></omgdi:waypoint></bpmndi:BPMNEdge><bpmndi:BPMNEdge bpmnElement=\"line-7a5fc671\" id=\"BPMNEdge_line-7a5fc671\"><omgdi:waypoint x=\"0\" y=\"0\"></omgdi:waypoint><omgdi:waypoint x=\"0\" y=\"0\"></omgdi:waypoint></bpmndi:BPMNEdge></bpmndi:BPMNPlane></bpmndi:BPMNDiagram></definitions>","formId":"756585727382392840","name":"approval_flow","ruleCyclePeriod":"","ruleCycleTime":"undefined undefined * * ?","ruleType":0,"status":0,"type":0,"pushFlag":0},"procNodes":[{"assignee":"756574317326995456","assigneeType":6,"formId":"756585727382392840","name":"review","formLayoutCode":"kaipiaoshenpi","pushMsg":0,"taskDefKey":"review-252a859f","id":"","sequence":1},{"assignee":"","assigneeType":-1,"formId":"756585727382392840","name":"node","formLayoutCode":"","pushMsg":0,"taskDefKey":"input-97814ba8","id":"","sequence":0}],"procMsg":{"assignee":"756585370497454081","assigneeType":5}} a = RestClient(rooturl) res = a.request(url=csurl, method=method, json=data, headers=headers) print(res.text) check_codes_msg(res, yamlvalue, mainkey) check_datas(res, yamlvalue)
def test009_active_process(self): func_name = sys._getframe().f_code.co_name approval_id, procDefId=Test_process_manage.search_process(self,name='approval_flow') work_id, procDefId= Test_process_manage.search_process(self, name='work_flow') csurl, method, headers, yamlvalue, yaml_path, mainkey = get_common_params('process_manage.yaml', func_name) a = RestClient(rooturl) url=csurl+str(approval_id)+','+str(work_id)+'/enable' res = a.request(url=url, method=method, headers=headers) check_codes_msg(res, yamlvalue, mainkey) check_datas(res, yamlvalue)
def insert_module_data(is_login): """批量插入跟进记录表单数据""" module_datas = get_pre_data('module_datas.yaml', 'data') rooturl = get_root_urls() csurl = '/apis/crm-web/module/genjinjilu/insert' a = RestClient(rooturl) head = { 'access-token': is_login[0], 'refresh-token': is_login[1], 'Content-Type': 'application/json;charset=UTF-8' } dataid_list = [] for jdata in module_datas: r_in = a.request(csurl, 'POST', json=jdata, headers=head) dataid_list.append(json.loads(r_in.text)['data']['_id']) yield dataid_list csurl_de = '/apis/crm-web/module/genjinjilu/' for de_id in dataid_list: a.request(csurl_de + de_id, 'DELETE', headers=head) print('delete success')
def test002_user_infor(self): # 传入用例名称获取yaml数据字典 func_name = sys._getframe().f_code.co_name func_name = sys._getframe().f_code.co_name csurl, method, headers, yamlvalue, yaml_path, mainkey = get_common_params( 'personal_center.yaml', func_name) a = RestClient(rooturl) res = a.request(csurl, method, headers=headers) # print(res.text) check_codes_msg(res, yamlvalue, mainkey) check_datas(res, yamlvalue)
def test010_merge_sum(self): func_name = sys._getframe().f_code.co_name csurl, method, headers, yamlvalue, yaml_path, mainkey = get_common_params('merge.yaml', func_name) a = RestClient(rooturl) res = a.request(url=csurl, method=method, json=yamlvalue['data'], headers=headers) check_codes_msg(res, yamlvalue, mainkey) check_datas(res, yamlvalue) Test_merge.insert_order_data(self) order_list = rd.load_yaml_value(yaml_path, 'ids', 'order') order_id = order_list[0] Test_merge.insert_huikuanjilu_data(self,order_id)
def test003list_mapping(self): func_name = sys._getframe().f_code.co_name csurl, method, headers, yamlvalue, yaml_path, mainkey = get_common_params('mapping.yaml', func_name) data= {"pageIndex": 1, "pageSize": 10} a = RestClient(rooturl) res = a.request(url=csurl, method=method, json=data, headers=headers) check_codes_msg(res, yamlvalue, mainkey) pytest.assume('756585727382392832' in res.text) pytest.assume('756585730700087298' in res.text) pytest.assume('756585727382392833' in res.text) pytest.assume('756585730700087325' in res.text)
def test006_search_phone_exist(self): func_name = sys._getframe().f_code.co_name csurl, method, headers, yamlvalue, yaml_path, mainkey = get_common_params( 'test_module_title.yaml', func_name) a = RestClient(rooturl) res = a.request(url=csurl, method=method, json=yamlvalue['data'], headers=headers) check_codes_msg(res, yamlvalue, mainkey) check_datas(res, yamlvalue)
def test001_create_mapping(self): func_name = sys._getframe().f_code.co_name csurl, method, headers, yamlvalue, yaml_path, mainkey = get_common_params('mapping.yaml', func_name) a = RestClient(rooturl) res = a.request(url=csurl, method=method, json=yamlvalue['data'], headers=headers) check_codes_msg(res, yamlvalue, mainkey) check_datas(res, yamlvalue) #获取映射id dict = json.loads(res.text) data = dict['data'] mapping_id = data['id'] wd.write_yaml(yaml_path,'variable','mapping_id',mapping_id)
def testlogin(self, case): """ 登陆测试 """ rooturl = ini_data['host']['api_root_url'] loginurl = case['route'] method = case['method'] data = case['data'] hd = case['headers'] a = RestClient(rooturl) r = a.request(loginurl, method, json=data, headers=hd) check_codes_msg(r, case)
def test015_del_neq(self): func_name = sys._getframe().f_code.co_name csurl, method, headers, yamlvalue, yaml_path, mainkey = get_common_params( 'test_module_title.yaml', func_name) a = RestClient(rooturl) url = csurl + rd.load_yaml_value(yaml_path, 'variable', 'neq_id') res = a.request(url=url, method=method, json=yamlvalue['data'], headers=headers) check_codes_msg(res, yamlvalue, mainkey) check_datas(res, yamlvalue)
def get_process_data(self, name): func_name = sys._getframe().f_code.co_name data = {"procDefName": name, "pageIndex": 1, "pageSize": 10, "startApplyTime": None, "endApplyTime": None, "type": 0} csurl, method, headers, yamlvalue, yaml_path, mainkey = get_common_params('process_manage.yaml', func_name) a = RestClient(rooturl) res = a.request(url=csurl, method=method, json=data, headers=headers) dict = json.loads(res.text) data = dict['data']['list'][0] print(type(data),data) procInstId = data['procInstId'] print('----------查询成功!') return procInstId
def search_process(self, name): url = f'/apis/crm-workflow/workflow/procDefs?name={name}&type&status&formId&pageIndex=1&pageSize=10' func_name = sys._getframe().f_code.co_name csurl, method, headers, yamlvalue, yaml_path, mainkey = get_common_params('process_manage.yaml', func_name) a = RestClient(rooturl) res = a.request(url=url, method=method, headers=headers) dict = json.loads(res.text) data = dict['data'] list = data['list'] id_dict = list[0] id = id_dict['id'] procDefId = id_dict['procDefId'] print('----------查询成功!') return id, procDefId
def insert_order_data(self): func_name = sys._getframe().f_code.co_name csurl, method, headers, yamlvalue, yaml_path, mainkey = get_common_params('merge.yaml', func_name) a = RestClient(rooturl) res = a.request(url=csurl, method=method,json=yamlvalue['data'], headers=headers) res_json = json.loads(res.text) order_id = res_json['data']['_id'] order_id_list = [order_id] # update_list = rd.load_yaml_value(yaml_path,'ids','order') # update_list.append(order_id) wd.write_yaml(yaml_path,'ids','order',order_id_list) check_codes_msg(res, yamlvalue, mainkey) check_datas(res, yamlvalue) return order_id