-
Notifications
You must be signed in to change notification settings - Fork 23
/
address.http
131 lines (106 loc) · 3.18 KB
/
address.http
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
### Fake Request to set global port 4080 (local) 8888 (docker)
GET https://postman-echo.com/get?foo1=bar1&foo2=bar2
> {%
client.global.set("port", "4080");
// client.global.set("port", "8888");
%}
### Login and get Bearer
POST http://localhost:{{port}}/starter-test/login
Content-Type: application/json
{
"username": "admin.admin",
"password": "test1234",
"verificationCode": ""
}
> {%
client.test("Request executed successfully", function() {
client.assert(response.status === 200, "Response status is not 200");
});
client.global.set("auth_token", response.headers.valueOf("Authorization").replace("Bearer ", ""));
%}
### Login as user
POST http://localhost:{{port}}/starter-test/login
Content-Type: application/json
{
"username": "john.doe",
"password": "test1234",
"verificationCode": "650364"
}
> {%
client.test("Request executed successfully", function() {
client.assert(response.status === 200, "Response status is not 200");
});
%}
### Add / Update
POST http://localhost:{{port}}/starter-test/api/v1/address
Content-Type: application/json
Authorization: Bearer {{auth_token}}
{
"name": "Someone",
"street": "Somestreet",
"zip": "1234",
"city": "Somecity",
"email": "[email protected]",
"tel": "520-891-3434",
"enabled": true,
"lastModfied": "2022-01-01T00:00:00",
"options": {
"option2": "value2"
},
"things": []
}
> {%
client.test("Request executed successfully", function() {
client.assert(response.status === 200, "Response status is not 200");
});
const body = response.body;
client.global.set("test_address_id", body['id']);
%}
### Get all
GET http://localhost:{{port}}/starter-test/api/v1/address
Content-Type: application/json
Authorization: Bearer {{auth_token}}
> {%
client.test("Request executed successfully", function() {
client.assert(response.status === 200, "Response status is not 200");
});
%}
### Get 1
GET http://localhost:{{port}}/starter-test/api/v1/address/{{test_address_id}}
Content-Type: application/json
Authorization: Bearer {{auth_token}}
> {%
client.test("Request executed successfully", function() {
client.assert(response.status === 200, "Response status is not 200");
});
%}
### Import
POST http://localhost:{{port}}/starter-test/api/v1/address/import
Content-Type: multipart/form-data; boundary=WebAppBoundary
Authorization: Bearer {{auth_token}}
--WebAppBoundary
Content-Disposition: form-data; name="file"; filename="address-import.csv"
Content-Type: text/csv
< ./address-import.csv
--WebAppBoundary--
> {%
client.test("Request executed successfully", function() {
client.assert(response.status === 200, "Response status is not 200");
});
%}
### Export
GET http://localhost:{{port}}/starter-test/api/v1/address/export
Authorization: Bearer {{auth_token}}
> {%
client.test("Request executed successfully", function() {
client.assert(response.status === 200, "Response status is not 200");
});
%}
### Delete
DELETE http://localhost:{{port}}/starter-test/api/v1/address/{{test_address_id}}
Authorization: Bearer {{auth_token}}
> {%
client.test("Request executed successfully", function() {
client.assert(response.status === 200, "Response status is not 200");
});
%}