using 201 for created entities in etapi

This commit is contained in:
zadam
2022-01-12 21:14:12 +01:00
parent ce046b2e20
commit 2248d98cc7
10 changed files with 67 additions and 56 deletions

View File

@@ -6,7 +6,7 @@ Content-Type: application/json
}
> {%
client.assert(response.status === 200);
client.assert(response.status === 201);
client.global.set("authToken", response.body.authToken);
%}
%}

View File

@@ -11,15 +11,15 @@ Content-Type: application/json
"content": "Hi there!"
}
> {%
client.assert(response.status === 200);
> {%
client.assert(response.status === 201);
client.assert(response.body.note.noteId.startsWith("forcedId"));
client.assert(response.body.note.title == "Hello");
client.assert(response.body.branch.branchId.startsWith("forcedId"));
client.assert(response.body.branch.parentNoteId == "root");
client.log(`Created note ` + response.body.note.noteId + ` and branch ` + response.body.branch.branchId);
client.global.set("createdNoteId", response.body.note.noteId);
client.global.set("createdBranchId", response.body.branch.branchId);
%}
@@ -37,11 +37,11 @@ Content-Type: application/json
}
> {%
client.assert(response.status === 200);
client.assert(response.status === 201);
client.assert(response.body.parentNoteId == "hidden");
client.global.set("clonedBranchId", response.body.branchId);
client.log(`Created cloned branch ` + response.body.branchId);
%}
@@ -107,9 +107,9 @@ Authorization: {{authToken}}
}
> {%
client.assert(response.status === 200);
client.assert(response.status === 201);
client.assert(response.body.attributeId.startsWith("forcedAttributeId"));
client.global.set("createdAttributeId", response.body.attributeId);
%}
@@ -121,4 +121,4 @@ Authorization: {{authToken}}
> {%
client.assert(response.status === 200);
client.assert(response.body.attributeId == client.global.get("createdAttributeId"));
%}
%}

View File

@@ -6,8 +6,8 @@ Content-Type: application/json
}
> {%
client.assert(response.status === 200);
client.assert(response.status === 201);
client.global.set("testAuthToken", response.body.authToken);
%}
@@ -31,4 +31,4 @@ Content-Type: application/json
GET {{triliumHost}}/etapi/notes/root
Authorization: {{testAuthToken}}
> {% client.assert(response.status === 401); %}
> {% client.assert(response.status === 401); %}