-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathregistrations.http
110 lines (91 loc) · 2.74 KB
/
registrations.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
### Create course for the whole season
// @no-log
POST http://localhost:8091/course-admin/season
> {%
client.test("Request executed successfully", function () {
client.assert(response.status === 204, `Response status is not 204, but ${response.status}`);
});
%}
### Get all coursestrue
< {%
import {wait} from "wait";
console.log("waiting 5 secs");
wait(5);
%}
GET http://localhost:8091/courses
> {%
client.test("Request executed successfully", function () {
client.assert(response.status === 200, `Response status is not 200, but ${response.status}`);
});
client.test("Content-Type is application/json", () => {
const contentType = response.headers.valueOf("content-type");
client.assert(contentType == "application/json",
`Expected Content-Type is application/json, but actual is ${contentType}`)
});
const courses = response.body;
const courseCount = jsonPath(courses, "$.length()");
client.test("Should have courses", () => {
client.assert(courseCount != 0, "Expected to have some courses available.")
});
%}
### Register kermit
// @no-log
POST http://localhost:8091/students
Content-Type: application/json
{
"person": {
"firstName": "Kermit",
"lastName": "The Frog",
"birthday": "1980-01-01",
"birthPlace": "Los Alamos"
},
"start": "2024-02-01",
"end": "2024-07-15"
}
> {%
client.test("Request executed successfully", function () {
client.assert(response.status === 201, `Response status is not 201, but ${response.status}`);
});
%}
### Register piggy
// @no-log
POST http://localhost:8091/students
Content-Type: application/json
{
"person": {
"firstName": "Piggy",
"lastName": "Miss",
"birthday": "1985-06-01",
"birthPlace": "Los Angeles"
},
"start": "2028-09-01",
"end": "2029-01-31"
}
> {%
client.test("Request executed successfully", function () {
client.assert(response.status === 201, `Response status is not 201, but ${response.status}`);
});
%}
### Retrieve students
< {%
import {wait} from "wait";
console.log("waiting 5 secs");
wait(5);
%}
// @no-log
GET http://localhost:8091/students
> {%
client.test("Request executed successfully", function () {
client.assert(response.status === 200, `Response status is not 200, but ${response.status}`);
});
client.test("Content-Type is application/json", () => {
const contentType = response.headers.valueOf("content-type");
client.assert(contentType == "application/json",
`Expected Content-Type is application/json, but actual is ${contentType}`)
});
const students = response.body;
const studentCount = jsonPath(students, "$.length()");
client.test("Should have students", () => {
client.assert(studentCount != 0, "Expected to have some students available.")
});
%}