Repository navigation
Expand file tree
/
Copy pathpostgres.json
More file actions
147 lines (147 loc) · 4.31 KB
/
Copy pathpostgres.json
File metadata and controls
147 lines (147 loc) · 4.31 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
{
"info": {
"name": "ScholarlyMail Articles API Tests",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "GET /articles",
"request": {
"method": "GET",
"header": [],
"url": "{{baseUrl}}/articles"
},
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test('Status code is 200', () => pm.response.to.have.status(200));",
"pm.test('Response is an array', () => {",
" const data = pm.response.json();",
" pm.expect(data).to.be.an('array');",
"});"
],
"type": "text/javascript"
}
}
]
},
{
"name": "POST /articles",
"request": {
"method": "POST",
"header": [{ "key": "Content-Type", "value": "application/json" }],
"body": {
"mode": "raw",
"raw": "{\n \"id\": \"1\",\n \"title\": \"Maven in 5 minutes\",\n \"url\": \"https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html\",\n \"createdAt\": \"2025-11-03\"\n}"
},
"url": "{{baseUrl}}/articles"
},
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test('Status code is 201 or 200', () => pm.expect([200,201]).to.include(pm.response.code));",
"const json = pm.response.json();",
"pm.test('Returned article has correct title', () => pm.expect(json.title).to.eql('Maven in 5 minutes'));",
"pm.environment.set('articleId', json.id);"
],
"type": "text/javascript"
}
}
]
},
{
"name": "GET /articles/:id",
"request": {
"method": "GET",
"header": [],
"url": "{{baseUrl}}/articles/{{articleId}}"
},
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test('Status code is 200', () => pm.response.to.have.status(200));",
"const json = pm.response.json();",
"pm.test('Returned article matches created one', () => pm.expect(json.id).to.eql(pm.environment.get('articleId')));"
],
"type": "text/javascript"
}
}
]
},
{
"name": "PATCH /articles/:id",
"request": {
"method": "PATCH",
"header": [{ "key": "Content-Type", "value": "application/json" }],
"body": { "mode": "raw", "raw": "{ \"title\": \"Maven in 4 minutes\" }" },
"url": "{{baseUrl}}/articles/{{articleId}}"
},
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test('Status code is 200', () => pm.response.to.have.status(200));",
"const json = pm.response.json();",
"pm.test('Title was updated', () => pm.expect(json.title).to.eql('Maven in 4 minutes'));"
],
"type": "text/javascript"
}
}
]
},
{
"name": "PATCH /articles/:id/read",
"request": {
"method": "PATCH",
"header": [],
"url": "{{baseUrl}}/articles/{{articleId}}/read"
},
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test('Status code is 200', () => pm.response.to.have.status(200));",
"const json = pm.response.json();",
"pm.test('Article is marked as read', () => pm.expect(json.read).to.be.true);"
],
"type": "text/javascript"
}
}
]
},
{
"name": "DELETE /articles/:id",
"request": {
"method": "DELETE",
"header": [],
"url": "{{baseUrl}}/articles/{{articleId}}"
},
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test('Status code is 200 or 204', () => pm.expect([200,204]).to.include(pm.response.code));",
"pm.test('Response data is empty', () => pm.expect(pm.response.data).eq(undefined));"
],
"type": "text/javascript"
}
}
]
}
],
"variable": [
{
"key": "baseUrl",
"value": "http://localhost:8080"
}
]
}