-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi_test.http
More file actions
254 lines (194 loc) · 6.37 KB
/
api_test.http
File metadata and controls
254 lines (194 loc) · 6.37 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
### Stall Service API Tests
### Base URL
@baseUrl = https://miniature-space-fortnight-p9945qrp4xpf7q46-8081.app.github.dev
@identityUrl = https://j2bxq20h-8081.asse.devtunnels.ms/api/v1
###############################################
# Health Check (No Auth Required)
###############################################
### Health Check - Stall Service
GET {{baseUrl}}/actuator/health
### Health Check - Identity Service
GET {{identityUrl}}/actuator/health
###############################################
# Identity Service - Get Access Tokens
###############################################
### Get Token for Admin User
# @name getAdminToken
POST {{identityUrl}}/auth/login
Content-Type: application/json
{
"username": "admin",
"password": "admin123"
}
### Refresh Token
# @name refreshToken
POST {{identityUrl}}/auth/refresh
Content-Type: application/json
{
"refreshToken": "{{getAdminToken.response.body.refreshToken}}"
}
@accessToken = {{getAdminToken.response.body.accessToken}}
###############################################
# Stall Management APIs (Require Auth)
###############################################
### Get All Stalls
GET {{baseUrl}}/api/stalls
Authorization: Bearer {{accessToken}}
### Get All Stalls with Pagination
GET {{baseUrl}}/api/stalls?page=0&size=10
Authorization: Bearer {{accessToken}}
### Filter Stalls by Status - Available
GET {{baseUrl}}/api/stalls?status=AVAILABLE
Authorization: Bearer {{accessToken}}
### Filter Stalls by Status - Held
GET {{baseUrl}}/api/stalls?status=HELD
Authorization: Bearer {{accessToken}}
### Filter Stalls by Status - Reserved
GET {{baseUrl}}/api/stalls?status=RESERVED
Authorization: Bearer {{accessToken}}
### Filter Stalls by Size - Small
GET {{baseUrl}}/api/stalls?stallSize=SMALL
Authorization: Bearer {{accessToken}}
### Filter Stalls by Size - Medium
GET {{baseUrl}}/api/stalls?stallSize=MEDIUM
Authorization: Bearer {{accessToken}}
### Filter Stalls by Size - Large
GET {{baseUrl}}/api/stalls?stallSize=LARGE
Authorization: Bearer {{accessToken}}
### Search Stalls by Location
GET {{baseUrl}}/api/stalls?location=Hall A
Authorization: Bearer {{accessToken}}
### Combined Filters - Available Large Stalls
GET {{baseUrl}}/api/stalls?status=AVAILABLE&stallSize=LARGE
Authorization: Bearer {{accessToken}}
### Get Stall by ID
GET {{baseUrl}}/api/stalls/1
Authorization: Bearer {{accessToken}}
### Get Stall by Code
GET {{baseUrl}}/api/stalls/code/A-001
Authorization: Bearer {{accessToken}}
###############################################
# Create Stall
###############################################
### Create a New Stall
POST {{baseUrl}}/api/stalls
Authorization: Bearer {{accessToken}}
Content-Type: application/json
{
"code": "TEST-001",
"size": "MEDIUM",
"location": "Test Hall - Section A",
"price": 1200.00
}
###############################################
# Update Stall
###############################################
### Update Stall
PUT {{baseUrl}}/api/stalls/1
Authorization: Bearer {{accessToken}}
Content-Type: application/json
{
"location": "Hall A - North Wing, Row 1 - Updated",
"price": 550.00
}
###############################################
# Reserve/Release Stall
###############################################
### Reserve a Stall
POST {{baseUrl}}/api/stalls/1/reserve
Authorization: Bearer {{accessToken}}
### Hold a Stall
POST {{baseUrl}}/api/stalls/1/hold
Authorization: Bearer {{accessToken}}
### Release a Stall (make it Available)
POST {{baseUrl}}/api/stalls/1/release
Authorization: Bearer {{accessToken}}
###############################################
# Delete Stall
###############################################
### Delete Stall
DELETE {{baseUrl}}/api/stalls/1
Authorization: Bearer {{accessToken}}
###############################################
# Sample Test Scenarios
###############################################
### Scenario 1: Find Available Medium Stalls in Hall A
GET {{baseUrl}}/api/stalls?status=AVAILABLE&stallSize=MEDIUM&location=Hall A
Authorization: Bearer {{accessToken}}
### Scenario 2: Get All Large Stalls
GET {{baseUrl}}/api/stalls?stallSize=LARGE
Authorization: Bearer {{accessToken}}
### Scenario 3: Check Outdoor Stalls
GET {{baseUrl}}/api/stalls?location=Outdoor
Authorization: Bearer {{accessToken}}
### Scenario 4: Get Expensive Stalls (using specific codes)
GET {{baseUrl}}/api/stalls/code/A-203
Authorization: Bearer {{accessToken}}
###
GET {{baseUrl}}/api/stalls/code/C-203
Authorization: Bearer {{accessToken}}
###############################################
# Error Cases (for testing validation)
###############################################
### Create Stall with Missing Required Fields
POST {{baseUrl}}/api/stalls
Authorization: Bearer {{accessToken}}
Content-Type: application/json
{
"code": "INVALID"
}
### Create Stall with Duplicate Code
POST {{baseUrl}}/api/stalls
Authorization: Bearer {{accessToken}}
Content-Type: application/json
{
"code": "A-001",
"size": "SMALL",
"location": "Test Location",
"price": 500.00
}
### Get Non-existent Stall
GET {{baseUrl}}/api/stalls/99999
Authorization: Bearer {{accessToken}}
### Get Stall with Invalid Code
GET {{baseUrl}}/api/stalls/code/INVALID-CODE
Authorization: Bearer {{accessToken}}
###############################################
# Testing Seeded Data
###############################################
### Get Hall A Stalls (Codes: A-001 to A-203)
GET {{baseUrl}}/api/stalls/code/A-001
Authorization: Bearer {{accessToken}}
###
GET {{baseUrl}}/api/stalls/code/A-101
Authorization: Bearer {{accessToken}}
###
GET {{baseUrl}}/api/stalls/code/A-201
Authorization: Bearer {{accessToken}}
### Get Hall B Stalls (Codes: B-001 to B-203)
GET {{baseUrl}}/api/stalls/code/B-001
Authorization: Bearer {{accessToken}}
###
GET {{baseUrl}}/api/stalls/code/B-101
Authorization: Bearer {{accessToken}}
###
GET {{baseUrl}}/api/stalls/code/B-201
Authorization: Bearer {{accessToken}}
### Get Hall C Stalls (Codes: C-001 to C-203)
GET {{baseUrl}}/api/stalls/code/C-001
Authorization: Bearer {{accessToken}}
###
GET {{baseUrl}}/api/stalls/code/C-101
Authorization: Bearer {{accessToken}}
###
GET {{baseUrl}}/api/stalls/code/C-201
Authorization: Bearer {{accessToken}}
### Get Outdoor Stalls (Codes: OUT-001 to OUT-003)
GET {{baseUrl}}/api/stalls/code/OUT-001
Authorization: Bearer {{accessToken}}
###
GET {{baseUrl}}/api/stalls/code/OUT-002
Authorization: Bearer {{accessToken}}
###
GET {{baseUrl}}/api/stalls/code/OUT-003
Authorization: Bearer {{accessToken}}