This repository was archived by the owner on Jan 15, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.http
More file actions
60 lines (51 loc) · 1.62 KB
/
test.http
File metadata and controls
60 lines (51 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
## GET todo entry
GET http://{{host}}:{{port}}/todo/1/
Accept: application/json
> {%
client.test("Get todo", function() {
client.assert(response.status === 200, "Response status is not 200");
});
%}
###
## GET todo entry
GET http://{{host}}:{{port}}/todo/42/
Accept: application/json
> {%
client.test("Todo was not found", function() {
client.assert(response.status === 404, "Response status is not 404");
});
%}
###
## POST Create new todo
POST http://{{host}}:{{port}}/todo/
Content-Type: application/json
{
"summary": "Lorem Ipsum",
"detail": null,
"created_at": "2022-09-05T18:07:19.280040+00:00"
}
> {%
client.test("Create new todo", function() {
client.assert(response.status === 201, "Response status is not 201");
client.assert(response.body.hasOwnProperty("id"), "Cannot find 'id' option in response");
});
%}
###
## POST Validation test
POST http://{{host}}:{{port}}/todo/
Content-Type: application/json
{
"summary": "Lo",
"detail": null,
"created_at": "2022-09-05T18:07:19.280040+00:00"
}
> {%
client.test("Validation error", function() {
client.assert(response.status === 422, "Response status is not 422");
client.assert(response.body.hasOwnProperty("type"), "Cannot find 'type' option in response");
client.assert(response.body.hasOwnProperty("message"), "Cannot find 'message' option in response");
client.assert(response.body.hasOwnProperty("validation_schema"), "Cannot find 'validation_schema' option in response");
client.assert(response.body.hasOwnProperty("path"), "Cannot find 'path' option in response");
});
%}
###