def test_create_res_dir(self): test = DmpLogin("http://10.110.87.233:8081") post = test.post_api("/catalogController/getCatalogListData", data={ "page": 1, "rows": 20, "searchContent": "citestresdir" }) if post['total'] < 1: add_res_dir = test.post_api("/catalogController/addCatalogInfo", json={ "classifyCode": "citestresdircode", "classifyName": "citestresdir", "descriptions": "", "pid": "-1", "pName": "", "contactPerson": "", "phone": "", "mobilePhone": "", "email": "", "orderid": "" }) if add_res_dir["code"] == "200": return True else: return False return True
def test_save_slaveServer(self): test = DmpLogin() post = test.post_api( "/slaveServer/saveSlaveServer?name=kettle&hostName=127.0.0.1&port=8080&webAppName=&username=CeNTILgC6rOizgrFBjPCQQ%3D%3D&password=CeNTILgC6rOizgrFBjPCQQ%3D%3D&idSlave=&master=0", data=None) util.info(post) assert (post['rtCode'] == '1' or post['rtCode'] == '2')
def test_resource_dir_add_batch(self): test = DmpLogin() postsearchci = test.post_api("/catalogController/addCatalogInfo", json={ "classifyCode": "ci" + str(TestReport.res_dir_index), "classifyName": "ci" + str(TestReport.res_dir_index), "descriptions": "", "pid": "-1", "pName": "", "contactPerson": "", "phone": "", "mobilePhone": "", "email": "", "orderid": "" }) TestReport.res_dir_index = TestReport.res_dir_index + 1 assert postsearchci['code'] == '200'
def test_resource_dir_add(self): test = DmpLogin() getCatalogListData = test.post_api( "/catalogController/getCatalogListData") for item in getCatalogListData['rows']: if item['CLASSIFYCODE'] == 'ci': # del deleteCatalog = test.post_api( "/catalogController/deleteCatalog", json=[item['ID']]) assert deleteCatalog['code'] == '200' postsearchci = test.post_api("/catalogController/addCatalogInfo", json={ "classifyCode": "ci", "classifyName": "ci", "descriptions": "", "pid": "-1", "pName": "", "contactPerson": "", "phone": "", "mobilePhone": "", "email": "", "orderid": "" }) assert postsearchci['code'] == '200'
def test_database(self): ''' 加工厂数据共享新建分类 :return: ''' test = DmpLogin() postsearch = test.get_api("/api/db/database") print(postsearch) assert postsearch['data']["databaseName"] == 'slkfjlesfjl失而复得'
def test_save_sub(self): test = DmpLogin() post = test.post_api("/subscribemanagement/subscribe", json={ "pubType": '10', "targetId": "s", "condition": "" }) util.info(post)
def test_save_slaveServer(self): test = DmpLogin() post = test.get_api("/subscribemanagement/subscribelist", params={ "size": 10, "page": 0 }) util.info(post) assert (post['rtCode'] == '1' or post['rtCode'] == '2')
def test_saveGroup(self): ''' 加工厂数据共享新建分类 :return: ''' test = DmpLogin() postsearch = test.post_api("/group/saveGroup", json={"id": "", "pid": "234", "caption": "ci", "code": "ci", "type": "244", "content": " "}) print(postsearch)
def test_applypass_res(self, catalogId='815510e4-2d9c-46ff-9c4e-6bdfff6803c9'): test = DmpLogin("http://10.110.87.233:8081") post = test.post_api( "/DataCatalogManagementController/getDataCatalogList?searchContent=citestres&page=1&rows=20", data={}) if len(post['rows']) == 1 and post['rows'][0]['ISAPPROVAL'] != 1: applypass = test.post_api( "/dataCatalogCheck/saveDataCatalogCheck?catalogId=" + catalogId, json={ "isApproval": "1", "approvalOpinion": "" })
def test_subscribe_batch(self): test = DmpLogin() # 获得当前时间 now = datetime.datetime.now() # 转换为指定的格式: otherStyleTime = now.strftime("%Y-%m-%d %H:%M:%S") for i in range(50): data = { 'pubType': "11", 'targetId': "12345678901234567" + otherStyleTime, 'condition': "12345678901234567" + otherStyleTime, 'remark': "" } post = test.post_api("/subscribemanagement/subscribe", json=data) util.info(post)
def test_apply_res(self): test = DmpLogin("http://10.110.87.233:8081") post = test.post_api( "/DataCatalogManagementController/getDataCatalogList?searchContent=citestres&page=1&rows=20", data={}) if post['total'] > 0: add_res_dir = test.post_api( "/DataCatalogManagementController/updateCatalogApprovalList?newIsApproval=4", json=[{ "ID": post['rows'][0] }]) if add_res_dir["state"] == "1": return True, post['rows'][0] else: return False, post['rows'][0] return True, post['rows'][0]
def test_del_label_scope(self): test = DmpLogin() # try: data = {"dimname": "ddtest", "dimcode": "ddtest", "descriptions": "test", "pid": "-1", "orderid": "1"} postsave = test.post_api("/labelDimension/saveTagDimension", json=data) print(postsave) postsearch = test.get_api("/labelDimension/getDimensionListData", {"searchContent": "ddtest", "page": 1, "size": 20}) print(postsearch) post = test.post_api("/labelDimension/deleteDimensionList", json=[postsearch['rows'][0]['ID']]) util.info(post) # except Exception as e: # print(e) # util.info(e) assert postsave['code'] == '200' assert postsearch['total'] == 1 assert post['code'] == '200'
def test_saveGroup(self): ''' 加工厂数据共享新建分类 :return: ''' test = DmpLogin() postsearchci = test.post_api("/modeltree/getSearchNodeIDs", data={ 'rootID': 'iDF', 'searchText': 'ci' }) if len(postsearchci) == 0: saveGroup = test.post_api("/group/saveGroup", json={ "id": "", "pid": "234", "caption": "ci", "code": "ci", "type": "244", "content": " " }) postdb = test.post_api("/dbConnPool/getDbConnPoolList", data=None) postsearchci = test.post_api("/modeltree/getSearchNodeIDs", data={ 'rootID': 'iDF', 'searchText': 'ci' }) postsearchcirepo = test.post_api("/modeltree/getSearchNodeIDs", data={ 'rootID': 'iDF', 'searchText': 'cirepo' }) if len(postsearchcirepo) < 1: saveRepository = test.post_api("/repository/saveRepository", json={ "id": None, "caption": "cirepo", "code": "cirepo", "nodePid": postsearchci[0], "nodeType": "253", "dbcpId": postdb[0]['DBCP_ID'], "dbType": "3", "description": "", "division": "", "industry": "", "leaddept": "", "impldept": "" }) assert saveRepository['ID'] != None
def test_collect_task(self): test = DmpLogin("http://10.110.87.233:8081") post = test.post_api("/collectTask/getCollectTaskList", data={ "page": 1, "rows": 20, "searchContent": "citest" }) if post['total'] < 1: # create addcollection = test.post_api("/collectTask/getCollectTaskList", data={ "page": 1, "rows": 20, "searchContent": "citest" }) respost = test.post_api( "/DataCatalogManagementController/getDataCatalogList?searchContent=citestres&page=1&rows=20", data={}) if respost['total'] > 0: itempost = test.post_api( "/collectTask/getDataCatalogItemList?catalogIds%5B%5D=" + post['rows'][0], data={}) itemlist = [] for i in itempost['rows']: itemlist.append({ "resourceId": i['CATALOGID'], "resourceItemId": i['ID'] }) addcollection = test.post_api("/collectTask/saveCollectTask", json={ "collectTaskItem": itemlist, "id": None, "code": "cicollect", "caption": "cicollect", "enabled": "1", "collectTaskTimeModel": { "repeatCheck": "1", "cycleType": "3", "minuteSetting": "", "daySetting": "01:00", "weekSetting": "", "monthSetting": "", "yearSetting": "" }, "datacatalogIds": [post['rows'][0]] })
class TestReport: @pytest.mark.parametrize("case,data,expected", list(list_params), ids=cases) def test_save_settingdata(self, case, data, expected): test = DmpLogin() setting_data = test.getSettingData() try: setting = json.loads(setting_data) data['id'] = setting['data']['basicInfoMap']['id'] post = test.post_api("/gzapi/save", json=data) util.info(post) except Exception as e: util.info(e) post = test.post_api("/gzapi/save", json=data) util.info(post) assert post['rs'] == expected['rs']
def test_report_test(self): data = { "id": "cdbe81ca-2f6c-4654-9c2d-14c9a42eb8bf", "ip": None, "port": None, "reportAgency": "云南国资委", "socialCreditCode": "1153000075718792X1", "apiCode": "SZ01", "userName": "******", "userPasswd": "Seq0vAPlI4kxaO82PA+VUA==", "preUserName": "******", "preUserPasswd": "Seq0vAPlI4kxaO82PA+VUA==", "uploadPath": "mvwO1O0sV9zehtOkSNf+IQ==", "downLoadPath": "92FbnU6mnuHwExgtaXhj1A==", "uploadUrl": "http://10.72.86.255:9010/preposed-machine/api/services/fileUpload", "catalogUrl": "http://10.72.86.255:9010/preposed-machine/api/services/tempDownload", "noticeUrl": "http://10.72.86.255:9010/preposed-machine/api/services/noticeDownload", "keyUrl": "http://10.72.86.255:9010/preposed-machine/api/services/keyDownload", "taskUrl": "http://10.72.86.255:9010/preposed-machine/api/services/taskDwonload", "logUrl": "http://10.72.86.255:9010/preposed-machine/api/services/logDownload", "acceptDataUrl": "", "prePollFileUrl": "http://127.0.0.1:8099/preposed-machine/api/superior/pollUploadFile", "preCatalogUrl": "", "preNoticeUrl": "", "preKeyUrl": "", "preTaskUrl": "", "preDataUrl": "", "preStatusUrl": "", "prePointConnUrl": "", "sm2Key": "B3516EC7813953B0953191884DC8BF3DA8C06F0001CC0A1B881E54A16881A4C44DBA333E388FF876CE4BD105EB4A4B03A72E9BD5BD8DEA68E6058B6A62B52CB6", "sm4Key": "7da306cb558948dab67f287d2b8f0f8e", "superiorSM2Key": "", "sm2PrivateKey": "", "modeWay": "1", "gridData": "[{\"businessCaption\":\"省国资委采集目录\",\"businessLabel\":\"0037\",\"reportPath\":\"\"},{\"businessCaption\":\"反馈文件\",\"businessLabel\":\"0007\",\"reportPath\":\"\"},{\"businessCaption\":\"静态文件\",\"businessLabel\":\"0002\",\"reportPath\":\"\"}]" } test = DmpLogin() setting_data = test.getSettingData() try: setting = json.loads(setting_data) data['id'] = setting['data']['basicInfoMap']['id'] post = test.post_api("/gzapi/save", json=data) util.info(post) except Exception as e: util.info(e) post = test.post_api("/gzapi/save", json=data) util.info(post) assert post['rs'] == '1'
def test_create_res(self): test = DmpLogin("http://10.110.87.233:8081") post = test.post_api( "/DataCatalogManagementController/getDataCatalogList?searchContent=citestres&page=1&rows=20", data={}) if post['total'] < 1: add_res_dir = test.post_api( "/DataCatalogManagementController/saveDataCatalog", json={ "id": "", "resourceCode": "citestrescode", "resourceName": "citestres", "resourceTypeId": "6dff9677-e6bb-4f02-b501-7661359cb30b", "resourceTypeName": "", "resourceProviderSub": "", "resourceProviderCode": "citestres", "resourceProvider": "citestres", "resourceAbstract": "", "resourceFormat": "OFD", "dataitemInfo": "", "shareType": "1", "shareCondition": "", "shareMode": "接口", "shareModeType": "1", "openSociety": "0", "openCodition": "", "renewalCycle": "每日", "releaseDate": "2021-02-04", "relatedResourceCode": "", "isApproval": "9", "dataSourceRange": "", "dataCollectRange": "", "catalogDataItems": [{ "id": "", "catalogId": "", "indxId": "", "dataitemName": "id", "dataitemCode": "id", "dataitemType": "2", "dataitemLength": "", "dataitemPrecision": "", "sortNumber": 0, "isUnstructured": "0", "shareType": "1", "shareCondition": "", "shareMode": "接口", "shareModeType": "1", "openSociety": "0", "openCodition": "", "renewalCycle": "每日", "datasourceId": "", "entableId": "", "fieldId": "", "dataStand": "", "createtime": "", "updateTime": "", "dataitemAbstract": "", "dataitemInstruction": "" }, { "id": "", "catalogId": "", "indxId": "", "dataitemName": "text", "dataitemCode": "text", "dataitemType": "0", "dataitemLength": "1111", "dataitemPrecision": "", "sortNumber": 1, "isUnstructured": "0", "shareType": "1", "shareCondition": "", "shareMode": "接口", "shareModeType": "1", "openSociety": "0", "openCodition": "", "renewalCycle": "每日", "datasourceId": "", "entableId": "", "fieldId": "", "dataStand": "", "createtime": "", "updateTime": "", "dataitemAbstract": "", "dataitemInstruction": "" }, { "id": "", "catalogId": "", "indxId": "", "dataitemName": "double", "dataitemCode": "double", "dataitemType": "1", "dataitemLength": "5", "dataitemPrecision": "2", "sortNumber": 2, "isUnstructured": "0", "shareType": "1", "shareCondition": "", "shareMode": "接口", "shareModeType": "1", "openSociety": "0", "openCodition": "", "renewalCycle": "每日", "datasourceId": "", "entableId": "", "fieldId": "", "dataStand": "", "createtime": "", "updateTime": "", "dataitemAbstract": "", "dataitemInstruction": "" }, { "id": "", "catalogId": "", "indxId": "", "dataitemName": "date", "dataitemCode": "date", "dataitemType": "3", "dataitemLength": "", "dataitemPrecision": "", "sortNumber": 3, "isUnstructured": "0", "shareType": "1", "shareCondition": "", "shareMode": "接口", "shareModeType": "1", "openSociety": "0", "openCodition": "", "renewalCycle": "每日", "datasourceId": "", "entableId": "", "fieldId": "", "dataStand": "", "createtime": "", "updateTime": "", "dataitemAbstract": "", "dataitemInstruction": "" }, { "id": "", "catalogId": "", "indxId": "", "dataitemName": "b", "dataitemCode": "b", "dataitemType": "6", "dataitemLength": "", "dataitemPrecision": "", "sortNumber": 4, "isUnstructured": "0", "shareType": "1", "shareCondition": "", "shareMode": "接口", "shareModeType": "1", "openSociety": "0", "openCodition": "", "renewalCycle": "每日", "datasourceId": "", "entableId": "", "fieldId": "", "dataStand": "", "createtime": "", "updateTime": "", "dataitemAbstract": "", "dataitemInstruction": "" }, { "id": "", "catalogId": "", "indxId": "", "dataitemName": "datetime", "dataitemCode": "datetime", "dataitemType": "7", "dataitemLength": "", "dataitemPrecision": "", "sortNumber": 5, "isUnstructured": "0", "shareType": "1", "shareCondition": "", "shareMode": "接口", "shareModeType": "1", "openSociety": "0", "openCodition": "", "renewalCycle": "每日", "datasourceId": "", "entableId": "", "fieldId": "", "dataStand": "", "createtime": "", "updateTime": "", "dataitemAbstract": "", "dataitemInstruction": "" }, { "id": "", "catalogId": "", "indxId": "", "dataitemName": "c", "dataitemCode": "c", "dataitemType": "8", "dataitemLength": "", "dataitemPrecision": "", "sortNumber": 6, "isUnstructured": "0", "shareType": "1", "shareCondition": "", "shareMode": "接口", "shareModeType": "1", "openSociety": "0", "openCodition": "", "renewalCycle": "每日", "datasourceId": "", "entableId": "", "fieldId": "", "dataStand": "", "createtime": "", "updateTime": "", "dataitemAbstract": "", "dataitemInstruction": "" }], "insertedInfo": [{ "id": "", "catalogId": "", "indxId": "", "dataitemName": "id", "dataitemCode": "id", "dataitemType": "2", "dataitemLength": "", "dataitemPrecision": "", "sortNumber": 0, "isUnstructured": "0", "shareType": "1", "shareCondition": "", "shareMode": "接口", "shareModeType": "1", "openSociety": "0", "openCodition": "", "renewalCycle": "每日", "datasourceId": "", "entableId": "", "fieldId": "", "dataStand": "", "createtime": "", "updateTime": "", "dataitemAbstract": "", "dataitemInstruction": "" }, { "id": "", "catalogId": "", "indxId": "", "dataitemName": "text", "dataitemCode": "text", "dataitemType": "0", "dataitemLength": "1111", "dataitemPrecision": "", "sortNumber": 1, "isUnstructured": "0", "shareType": "1", "shareCondition": "", "shareMode": "接口", "shareModeType": "1", "openSociety": "0", "openCodition": "", "renewalCycle": "每日", "datasourceId": "", "entableId": "", "fieldId": "", "dataStand": "", "createtime": "", "updateTime": "", "dataitemAbstract": "", "dataitemInstruction": "" }, { "id": "", "catalogId": "", "indxId": "", "dataitemName": "double", "dataitemCode": "double", "dataitemType": "1", "dataitemLength": "5", "dataitemPrecision": "2", "sortNumber": 2, "isUnstructured": "0", "shareType": "1", "shareCondition": "", "shareMode": "接口", "shareModeType": "1", "openSociety": "0", "openCodition": "", "renewalCycle": "每日", "datasourceId": "", "entableId": "", "fieldId": "", "dataStand": "", "createtime": "", "updateTime": "", "dataitemAbstract": "", "dataitemInstruction": "" }, { "id": "", "catalogId": "", "indxId": "", "dataitemName": "date", "dataitemCode": "date", "dataitemType": "3", "dataitemLength": "", "dataitemPrecision": "", "sortNumber": 3, "isUnstructured": "0", "shareType": "1", "shareCondition": "", "shareMode": "接口", "shareModeType": "1", "openSociety": "0", "openCodition": "", "renewalCycle": "每日", "datasourceId": "", "entableId": "", "fieldId": "", "dataStand": "", "createtime": "", "updateTime": "", "dataitemAbstract": "", "dataitemInstruction": "" }, { "id": "", "catalogId": "", "indxId": "", "dataitemName": "b", "dataitemCode": "b", "dataitemType": "6", "dataitemLength": "", "dataitemPrecision": "", "sortNumber": 4, "isUnstructured": "0", "shareType": "1", "shareCondition": "", "shareMode": "接口", "shareModeType": "1", "openSociety": "0", "openCodition": "", "renewalCycle": "每日", "datasourceId": "", "entableId": "", "fieldId": "", "dataStand": "", "createtime": "", "updateTime": "", "dataitemAbstract": "", "dataitemInstruction": "" }, { "id": "", "catalogId": "", "indxId": "", "dataitemName": "datetime", "dataitemCode": "datetime", "dataitemType": "7", "dataitemLength": "", "dataitemPrecision": "", "sortNumber": 5, "isUnstructured": "0", "shareType": "1", "shareCondition": "", "shareMode": "接口", "shareModeType": "1", "openSociety": "0", "openCodition": "", "renewalCycle": "每日", "datasourceId": "", "entableId": "", "fieldId": "", "dataStand": "", "createtime": "", "updateTime": "", "dataitemAbstract": "", "dataitemInstruction": "" }, { "id": "", "catalogId": "", "indxId": "", "dataitemName": "c", "dataitemCode": "c", "dataitemType": "8", "dataitemLength": "", "dataitemPrecision": "", "sortNumber": 6, "isUnstructured": "0", "shareType": "1", "shareCondition": "", "shareMode": "接口", "shareModeType": "1", "openSociety": "0", "openCodition": "", "renewalCycle": "每日", "datasourceId": "", "entableId": "", "fieldId": "", "dataStand": "", "createtime": "", "updateTime": "", "dataitemAbstract": "", "dataitemInstruction": "" }], "updatedInfo": [], "deletedInfo": [], "resourceTagIds": [] }) if add_res_dir["state"] == "1": return True else: return False return True
def test_lable_search_private_info(self): test = DmpLogin() postsearch = test.get_api("/labelDimension/getDimensionListData", {"searchContent": "ddtest", "page": 1, "size": 20}) print(postsearch)
def test_lable_search_private_info_del(self): test = DmpLogin() postsearch = test.post_api("/tagManagement/addTagInfo", {"searchContent": "ddtest", "page": 1, "size": 20}) print(postsearch)
def test_modeltree(self): test = DmpLogin() data = {"id": "DAST"} post = test.post_api("/modeltree/getChildNode", data=data) assert len(post) > 0
def test_label_scope(self): test = DmpLogin() postsearch = test.get_api("/labelDimension/getDimensionListData", { "page": 1, "size": 20}) print(postsearch) assert postsearch['total']>=10
def test_getSettingData(self): test = DmpLogin() postsearch = test.get_api("/gzapi/getSettingData") print(postsearch)
def test_getIdiEtlShow(self): test = DmpLogin() postsearch = test.get_api("/trans/getIdiEtlShow") print(postsearch)
def test_getRootAndDirectChildNodeDATS(self): test = DmpLogin() postsearch = test.post_api("/modeltree/getRootAndDirectChildNode", data={"id": "DATS"}) print(postsearch) assert len(postsearch) > 0