-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest_post.yml
More file actions
93 lines (93 loc) · 2.34 KB
/
test_post.yml
File metadata and controls
93 lines (93 loc) · 2.34 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
desc: "post endpoint tests"
runners:
req:
endpoint: http://localhost:3000
vars:
postId: "01J85A9VQ8ZDGXDC7A00YRWKBE"
if: included
steps:
postPost:
desc: "Create new post"
req:
/posts:
post:
body:
application/json:
id: "{{ vars.postId }}"
title: "new post"
views: 0
test: |
// Status code must be 201.
current.res.status == 201
&& current.res.body.id == vars.postId
&& current.res.body.title == "new post"
&& current.res.body.views == 0
getPost:
desc: "Get created post"
req:
/posts/{{ vars.postId }}:
get:
body:
application/json: null
test: |
// Status code must be 200.
current.res.status == 200
&& current.res.body.id == vars.postId
&& current.res.body.title == "new post"
&& current.res.body.views == 0
putPost:
desc: "Update post"
req:
/posts/{{ vars.postId }}:
put:
body:
application/json:
id: "{{ vars.postId }}"
title: "putted post"
views: 1000
likes: 100
test: |
// Status code must be 200.
current.res.status == 200
&& current.res.body.id == vars.postId
&& current.res.body.title == "putted post"
&& current.res.body.views == 1000
&& current.res.body.likes == 100
patchPost:
desc: "Change post data"
req:
/posts/{{ vars.postId }}:
patch:
body:
application/json:
title: "patched post"
views: 2000
test: |
// Status code must be 200.
current.res.status == 200
&& current.res.body.id == vars.postId
&& current.res.body.title == "patched post"
&& current.res.body.views == 2000
&& current.res.body.likes == 100
getAllPosts:
desc: "Get all posts"
req:
/posts:
get:
body:
application/json: null
test: |
// Status code must be 200.
current.res.status == 200
&& len(current.res.body.posts) > 0
deletePost:
desc: "Delete post"
req:
/posts/{{ vars.postId }}:
delete:
body:
application/json: null
test: |
// Status code must be 200.
current.res.status == 200
&& current.res.body.id == vars.postId