-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrest-api-tests.http
More file actions
155 lines (119 loc) · 5.22 KB
/
rest-api-tests.http
File metadata and controls
155 lines (119 loc) · 5.22 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
// the API tests work in IntelliJ WebStorm (not sure if they can be run out-of-the-box in other IDE/environment)
// before running tests, make sure the API server is running (`yarn start`)
### image/metadata
POST http://localhost:3000/image/metadata
Content-Type: multipart/form-data; boundary=WebAppBoundary
--WebAppBoundary
Content-Disposition: form-data; name="file"; filename="test-image.jpg"
Content-Type: image/jpg
< ./test/resources/test-image.jpg
--WebAppBoundary--
> {%
client.test("Request executed successfully", function() {
client.assert(response.status === 200, "Response status is not 200");
});
client.test("Response content-type is json", function() {
var type = response.contentType.mimeType;
client.assert(type === "application/json", "Expected 'application/json' but received '" + type + "'");
});
client.test("Response body is an object with properties", function() {
var body = response.body;
client.assert(body.width, "Expected 'width' in response body");
client.assert(body.height, "Expected 'height' in response body");
client.assert(body.mimeType, "Expected 'mimeType' in response body");
client.assert(body.orientation, "Expected 'orientation' in response body");
});
%}
### image/request-reply/resize
POST http://localhost:3000/image/request-reply/resize?height=300&width=300
Content-Type: multipart/form-data; boundary=WebAppBoundary
--WebAppBoundary
Content-Disposition: form-data; name="file"; filename="test-image.jpg"
Content-Type: image/jpg
< ./test/resources/test-image.jpg
--WebAppBoundary--
> {%
client.test("Request executed successfully", function() {
client.assert(response.status === 200, "Response status is not 200");
});
client.test("Response content-type is image/jpg", function() {
var type = response.contentType.mimeType;
client.assert(type === "image/jpg", "Expected 'image/jpg' but received '" + type + "'");
});
%}
### image/request-reply/crop
POST http://localhost:3000/image/request-reply/crop?top=10&left=10&height=30&width=30
Content-Type: multipart/form-data; boundary=WebAppBoundary
--WebAppBoundary
Content-Disposition: form-data; name="file"; filename="test-image.jpg"
Content-Type: image/jpg
< ./test/resources/test-image.jpg
--WebAppBoundary--
> {%
client.test("Request executed successfully", function() {
client.assert(response.status === 200, "Response status is not 200");
});
client.test("Response content-type is image/jpg", function() {
var type = response.contentType.mimeType;
client.assert(type === "image/jpg", "Expected 'image/jpg' but received '" + type + "'");
});
%}
### video/metadata
POST http://localhost:3000/video/metadata
Content-Type: multipart/form-data; boundary=WebAppBoundary
--WebAppBoundary
Content-Disposition: form-data; name="file"; filename="test-video.mp4"
Content-Type: video/mp4
< ./test/resources/test-video.mp4
--WebAppBoundary--
> {%
client.test("Request executed successfully", function() {
client.assert(response.status === 200, "Response status is not 200");
});
client.test("Response content-type is json", function() {
var type = response.contentType.mimeType;
client.assert(type === "application/json", "Expected 'application/json' but received '" + type + "'");
});
client.test("Response body is an object with properties", function() {
var body = response.body;
client.assert(body.width, "Expected 'width' in response body");
client.assert(body.height, "Expected 'height' in response body");
client.assert(body.duration, "Expected 'duration' in response body");
client.assert(body.mimeType, "Expected 'mimeType' in response body");
client.assert(body.orientation, "Expected 'orientation' in response body");
});
%}
### video/request-reply/thumbnail
POST http://localhost:3000/video/request-reply/thumbnail?second=3
Content-Type: multipart/form-data; boundary=WebAppBoundary
--WebAppBoundary
Content-Disposition: form-data; name="file"; filename="test-video.mp4"
Content-Type: video/mp4
< ./test/resources/test-video.mp4
--WebAppBoundary--
> {%
client.test("Request executed successfully", function() {
client.assert(response.status === 200, "Response status is not 200");
});
client.test("Response content-type is image/png", function() {
var type = response.contentType.mimeType;
client.assert(type === "image/png", "Expected 'image/png' but received '" + type + "'");
});
%}
### video/request-reply/resize
POST http://localhost:3000/video/request-reply/resize?height=300&width=300&codecName=h264
Content-Type: multipart/form-data; boundary=WebAppBoundary
--WebAppBoundary
Content-Disposition: form-data; name="file"; filename="test-video.mp4"
Content-Type: video/mp4
< ./test/resources/test-video.mp4
--WebAppBoundary--
> {%
client.test("Request executed successfully", function() {
client.assert(response.status === 200, "Response status is not 200");
});
client.test("Response content-type is video/mp4", function() {
var type = response.contentType.mimeType;
client.assert(type === "video/mp4", "Expected 'video/mp4' but received '" + type + "'");
});
%}