-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathintegration_test.http
More file actions
140 lines (113 loc) · 2.69 KB
/
Copy pathintegration_test.http
File metadata and controls
140 lines (113 loc) · 2.69 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
### Register moderator
< {%
client.global.set("mEmail", $random.email)
%}
POST http://localhost:8080/register
Content-Type: application/json
{
"email": "{{mEmail}}",
"password": "1234",
"role": "moderator"
}
> {%
client.test("Need created", () => {
client.assert(response.status == 201, "wrong status")
})
%}
### Register employee
< {%
client.global.set("eEmail", $random.email)
%}
POST http://localhost:8080/register
Content-Type: application/json
{
"email": "{{eEmail}}",
"password": "1234",
"role": "employee"
}
> {%
client.test("Need created", () => {
client.assert(response.status == 201, "wrong status")
})
%}
### Log in moderator
POST http://localhost:8080/login
Content-Type: application/json
{
"email": "{{mEmail}}",
"password": "1234"
}
> {%
client.global.set("md_token", response.body);
client.test("Need ok", () => {
client.assert(response.status == 200, "wrong status")
});
%}
### Log in employee
POST http://localhost:8080/login
Content-Type: application/json
{
"email": "{{eEmail}}",
"password": "1234"
}
> {%
client.global.set("emp_token", response.body);
client.test("Need ok", () => {
client.assert(response.status == 200, "wrong status")
});
%}
### Create not existing pvz
< {%
client.global.set("uPvzID", $random.uuid)
%}
POST http://localhost:8080/pvz
Content-Type: application/json
Authorization: Bearer {{md_token}}
{
"id": "{{uPvzID}}",
"registrationDate": "{{$isoTimestamp}}",
"city": "Москва"
}
> {%
client.test("Need created", () => {
client.assert(response.status == 201, "wrong status")
});
%}
### Create new correct reception
POST http://localhost:8080/receptions
Content-Type: application/json
Authorization: Bearer {{emp_token}}
{
"pvzId":"{{uPvzID}}"
}
> {%
client.test("Need created", () => {
client.assert(response.status == 201, "wrong status")
});
%}
### Add correct product
< {%
let products = ["электроника", "одежда", "обувь"]
let types = Array.from({length: 50}, (_, i) => products[i % products.length]);
request.variables.set("type", types)
%}
POST http://localhost:8080/products
Content-Type: application/json
Authorization: Bearer {{emp_token}}
{
"type": "{{type}}",
"pvzId": "{{uPvzID}}"
}
> {%
client.test("Need created", () => {
client.assert(response.status == 201, `want ${201}, got ${response.status}`)
});
%}
### Close last opened reception
POST http://localhost:8080/pvz/{{uPvzID}}/close_last_reception
Authorization: Bearer {{emp_token}}
> {%
client.test("Need ok", () => {
client.assert(response.status == 200, `want ${200}, got ${response.status}`)
});
%}