Skip to content

Commit

Permalink
adapt for api test
Browse files Browse the repository at this point in the history
Change-Id: I252f5cab53c2f0de8506342cfb7c9ab0178fc1d6
  • Loading branch information
zhoney committed Aug 24, 2021
1 parent d226f97 commit cec43d6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,49 +202,49 @@ protected static void initPropertyKey() {
+ "\"cardinality\": \"SINGLE\",\n"
+ "\"check_exist\": false,\n"
+ "\"properties\":[]\n"
+ "}");
+ "}", 202);
createAndAssert(path, "{\n"
+ "\"name\": \"age\",\n"
+ "\"data_type\": \"INT\",\n"
+ "\"cardinality\": \"SINGLE\",\n"
+ "\"check_exist\": false,\n"
+ "\"properties\":[]\n"
+ "}");
+ "}", 202);
createAndAssert(path, "{\n"
+ "\"name\": \"city\",\n"
+ "\"data_type\": \"TEXT\",\n"
+ "\"cardinality\": \"SINGLE\",\n"
+ "\"check_exist\": false,\n"
+ "\"properties\":[]\n"
+ "}");
+ "}", 202);
createAndAssert(path, "{\n"
+ "\"name\": \"lang\",\n"
+ "\"data_type\": \"TEXT\",\n"
+ "\"cardinality\": \"SINGLE\",\n"
+ "\"check_exist\": false,\n"
+ "\"properties\":[]\n"
+ "}");
+ "}", 202);
createAndAssert(path, "{\n"
+ "\"name\": \"date\",\n"
+ "\"data_type\": \"TEXT\",\n"
+ "\"cardinality\": \"SINGLE\",\n"
+ "\"check_exist\": false,\n"
+ "\"properties\":[]\n"
+ "}");
+ "}", 202);
createAndAssert(path, "{\n"
+ "\"name\": \"price\",\n"
+ "\"data_type\": \"INT\",\n"
+ "\"cardinality\": \"SINGLE\",\n"
+ "\"check_exist\": false,\n"
+ "\"properties\":[]\n"
+ "}");
+ "}", 202);
createAndAssert(path, "{\n"
+ "\"name\": \"weight\",\n"
+ "\"data_type\": \"DOUBLE\",\n"
+ "\"cardinality\": \"SINGLE\",\n"
+ "\"check_exist\": false,\n"
+ "\"properties\":[]\n"
+ "}");
+ "}", 202);
}

protected static void initVertexLabel() {
Expand Down Expand Up @@ -427,8 +427,13 @@ protected static void initVertex() {
}

protected static Response createAndAssert(String path, String body) {
return createAndAssert(path, body, 201);
}

protected static Response createAndAssert(String path, String body,
int status) {
Response r = client.post(path, body);
assertResponseStatus(201, r);
assertResponseStatus(status, r);
return r;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ public void testSetVertexProperty() {
+ "\"cardinality\": \"SINGLE\","
+ "\"properties\":[]"
+ "}";
assertResponseStatus(201, client().post(pkPath, foo));
assertResponseStatus(202, client().post(pkPath, foo));
// Cardinality list
String bar = "{"
+ "\"name\": \"bar\","
+ "\"data_type\": \"TEXT\","
+ "\"cardinality\": \"LIST\","
+ "\"properties\":[]"
+ "}";
assertResponseStatus(201, client().post(pkPath, bar));
assertResponseStatus(202, client().post(pkPath, bar));

String vlPath = "/graphs/hugegraph/schema/vertexlabels/";
String vertexLabel = "{"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void testCreate() {
+ "\"properties\":[]"
+ "}";
Response r = client().post(path, propertyKey);
assertResponseStatus(201, r);
assertResponseStatus(202, r);
}

@Test
Expand All @@ -50,7 +50,7 @@ public void testGet() {
+ "\"properties\":[]"
+ "}";
Response r = client().post(path, propertyKey);
assertResponseStatus(201, r);
assertResponseStatus(202, r);

String name = "id";
r = client().get(path, name);
Expand All @@ -66,7 +66,7 @@ public void testList() {
+ "\"properties\":[]"
+ "}";
Response r = client().post(path, propertyKey);
assertResponseStatus(201, r);
assertResponseStatus(202, r);

r = client().get(path);
assertResponseStatus(200, r);
Expand All @@ -81,7 +81,7 @@ public void testDelete() {
+ "\"properties\":[]"
+ "}";
Response r = client().post(path, propertyKey);
assertResponseStatus(201, r);
assertResponseStatus(202, r);

String name = "id";
r = client().delete(path, name);
Expand Down

0 comments on commit cec43d6

Please sign in to comment.