コード例 #1
0
 def test_addVertexLabel_PRIMARYKEY_labelIndexNotNull_PRIMARYKEYPropertyNull(
         self):
     """
     异常case,添加顶点类型,ID策略(主键),类型索引不为空,主键属性为空
     """
     self.test_addProperty_textSingle()
     code, res = GraphConnection().get_graph_connect()
     graph_id = res['data']['records'][0]['id']
     body = {
         "name": "vertexLabel1",
         "id_strategy": "PRIMARY_KEY",
         "properties": [{
             "name": "string1",
             "nullable": False
         }],
         "primary_keys": [],
         "property_indexes": [],
         "open_label_index": True,
         "style": {
             "color": "#569380",
             "icon": None
         }
     }
     code, res = Schema.create_vertexLabel(body, graph_id)
     self.assertEqual(code, 200, "响应状态码不正确")
     self.assertEqual(res['status'], 400, "添加顶点类型状态码不正确")
     self.assertEqual(res['message'], "顶点类型 vertexLabel1 的主键属性不能为空",
                      "message信息提示错误")
コード例 #2
0
 def test_addVertexLabel_PRIMARYKEY(self):
     """
     添加顶点类型,ID策略(主键)
     """
     self.test_addProperty_textSingle()
     code, res = GraphConnection().get_graph_connect()
     graph_id = res['data']['records'][0]['id']
     body = {
         "name": "vertexLabel1",
         "id_strategy": "PRIMARY_KEY",
         "properties": [{
             "name": "string1",
             "nullable": False
         }],
         "primary_keys": ["string1"],
         "property_indexes": [],
         "open_label_index": False,
         "style": {
             "color": "#569380",
             "icon": None
         }
     }
     code, res = Schema.create_vertexLabel(body, graph_id)
     self.assertEqual(code, 200, "响应状态码不正确")
     self.assertEqual(res['status'], 200, "添加顶点类型状态码不正确")