예제 #1
0
 def test_start_load(self):
     """
     点击开始导入
     """
     self.test_add_load_setting()
     graph_id, job_id, file_id = ID.get_file_id()
     param = "file_mapping_ids=%d" % file_id
     code, res = Load.start_load(graph_id=graph_id, job_id=job_id, param=param)
     self.assertEqual(code, 200, "响应状态码不正确")
     self.assertEqual(res['status'], 200, "开始导入状态码不正确,开始导入失败")
     self.assertEqual(res['data'][0]['status'], 'RUNNING', "开始导入错误")
예제 #2
0
 def test_add_vertex_mapping(self):
     """
     设置顶点映射
     """
     self.test_add_file_setting()
     graph_id, job_id, file_id = ID.get_file_id()
     vertex_movie = {
         "label": "电影",
         "id_fields": ["名称"],
         "field_mapping": [{
             "column_name": "发行时间",
             "mapped_name": "发行时间"
         }, {
             "column_name": "类型",
             "mapped_name": "类型"
         }],
         "value_mapping": [],
         "null_values": {
             "checked": ["NULL", "null"],
             "customized": []
         }
     }
     # 年份
     vertex_time = {
         "label": "年份",
         "id_fields": ["发行时间"],
         "field_mapping": [],
         "value_mapping": [],
         "null_values": {
             "checked": ["NULL", "null"],
             "customized": []
         },
     }
     code, res = Mapping.add_vertex_mapping(body=vertex_movie, graph_id=graph_id, job_id=job_id, file_id=file_id)
     Mapping.add_vertex_mapping(body=vertex_time, graph_id=graph_id, job_id=job_id, file_id=file_id)
     self.assertEqual(code, 200, "响应状态码不正确")
     self.assertEqual(res['status'], 200, "文件添加顶点映射状态码不正确")
     self.assertEqual(res['data']['vertex_mappings'][0]['label'], vertex_movie['label'], "映射的顶点类型有误")
     self.assertEqual(res['data']['vertex_mappings'][0]['id_fields'], vertex_movie['id_fields'], "ID列有误")
     self.assertEqual(res['data']['vertex_mappings'][0]['field_mapping'], vertex_movie['field_mapping'], "列映射错误")
예제 #3
0
 def test_add_file_setting(self):
     """
     添加文件设置
     """
     self.test_upload_file()
     graph_id, job_id, file_id = ID.get_file_id()
     # 点击下一步
     Step.upload_file_next_step(graph_id=graph_id, job_id=job_id)
     body = {
         "has_header": True,
         "delimiter": ",",
         "format": "CSV",
         "charset": "UTF-8",
         "date_format": "yyyy",
         "time_zone": "GMT+8",
         "skipped_line": "(^#^//).*"
     }
     code, res = Mapping.add_file_setting(body=body, graph_id=graph_id, job_id=job_id, file_id=file_id)
     self.assertEqual(code, 200, "响应状态码不正确")
     self.assertEqual(res['status'], 200, "文件设置状态码不正确")
     self.assertEqual(res['data']['file_setting']['has_header'], body['has_header'], "文件头设置有误")
     self.assertEqual(res['data']['file_setting']['delimiter'], body['delimiter'], "文件分隔符设置有误")
     self.assertEqual(res['data']['file_setting']['date_format'], body['date_format'], "文件时间格式设置有误")
예제 #4
0
 def test_add_edge_mapping(self):
     """
     设置边映射
     """
     self.test_add_vertex_mapping()
     graph_id, job_id, file_id = ID.get_file_id()
     # 发行于
     edge_issue = {
         "label": "发行于",
         "source_fields": ["名称"],
         "target_fields": ["发行时间"],
         "field_mapping": [],
         "value_mapping": [],
         "null_values": {
             "checked": ["NULL", "null"],
             "customized": []
         }
     }
     code, res = Mapping.add_edge_mapping(body=edge_issue, graph_id=graph_id, job_id=job_id, file_id=file_id)
     self.assertEqual(code, 200, "响应状态码不正确")
     self.assertEqual(res['status'], 200, "文件添加边映射状态码不正确")
     self.assertEqual(res['data']['edge_mappings'][0]['label'], edge_issue['label'], "映射的边类型有误")
     self.assertEqual(res['data']['edge_mappings'][0]['source_fields'], edge_issue['source_fields'], "起点映射有误")
     self.assertEqual(res['data']['edge_mappings'][0]['target_fields'], edge_issue['target_fields'], "终点映射有误")