OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library pub_lish_test; | 5 library pub_lish_test; |
6 | 6 |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 import 'dart:json'; | 8 import 'dart:json'; |
9 | 9 |
10 import 'test_pub.dart'; | 10 import 'test_pub.dart'; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 }); | 46 }); |
47 } | 47 } |
48 | 48 |
49 main() { | 49 main() { |
50 setUp(() => normalPackage.scheduleCreate()); | 50 setUp(() => normalPackage.scheduleCreate()); |
51 | 51 |
52 test('archives and uploads a package', () { | 52 test('archives and uploads a package', () { |
53 var server = new ScheduledServer(); | 53 var server = new ScheduledServer(); |
54 credentialsFile(server, 'access token').scheduleCreate(); | 54 credentialsFile(server, 'access token').scheduleCreate(); |
55 var pub = startPubLish(server); | 55 var pub = startPubLish(server); |
| 56 |
| 57 confirmPublish(pub); |
56 handleUploadForm(server); | 58 handleUploadForm(server); |
57 handleUpload(server); | 59 handleUpload(server); |
58 | 60 |
59 server.handle('GET', '/create', (request, response) { | 61 server.handle('GET', '/create', (request, response) { |
60 response.outputStream.writeString(JSON.stringify({ | 62 response.outputStream.writeString(JSON.stringify({ |
61 'success': {'message': 'Package test_pkg 1.0.0 uploaded!'} | 63 'success': {'message': 'Package test_pkg 1.0.0 uploaded!'} |
62 })); | 64 })); |
63 response.outputStream.close(); | 65 response.outputStream.close(); |
64 }); | 66 }); |
65 | 67 |
66 expectLater(pub.nextLine(), equals('Package test_pkg 1.0.0 uploaded!')); | 68 // TODO(rnystrom): The confirm line is run together with this one because |
| 69 // in normal usage, the user will have entered a newline on stdin which |
| 70 // gets echoed to the terminal. Do something better here? |
| 71 expectLater(pub.nextLine(), equals( |
| 72 'Looks great! Are you ready to upload your package (y/n)?' |
| 73 ' Package test_pkg 1.0.0 uploaded!')); |
67 pub.shouldExit(0); | 74 pub.shouldExit(0); |
68 | 75 |
69 run(); | 76 run(); |
70 }); | 77 }); |
71 | 78 |
72 // TODO(nweiz): Once a multipart/form-data parser in Dart exists, we should | 79 // TODO(nweiz): Once a multipart/form-data parser in Dart exists, we should |
73 // test that "pub lish" chooses the correct files to publish. | 80 // test that "pub lish" chooses the correct files to publish. |
74 | 81 |
75 test('credentials are invalid', () { | 82 test('credentials are invalid', () { |
76 var server = new ScheduledServer(); | 83 var server = new ScheduledServer(); |
77 credentialsFile(server, 'access token').scheduleCreate(); | 84 credentialsFile(server, 'access token').scheduleCreate(); |
78 var pub = startPubLish(server); | 85 var pub = startPubLish(server); |
79 | 86 |
| 87 confirmPublish(pub); |
| 88 |
80 server.handle('GET', '/packages/versions/new.json', (request, response) { | 89 server.handle('GET', '/packages/versions/new.json', (request, response) { |
81 response.statusCode = 401; | 90 response.statusCode = 401; |
82 response.headers.set('www-authenticate', 'Bearer error="invalid_token",' | 91 response.headers.set('www-authenticate', 'Bearer error="invalid_token",' |
83 ' error_description="your token sucks"'); | 92 ' error_description="your token sucks"'); |
84 response.outputStream.writeString(JSON.stringify({ | 93 response.outputStream.writeString(JSON.stringify({ |
85 'error': {'message': 'your token sucks'} | 94 'error': {'message': 'your token sucks'} |
86 })); | 95 })); |
87 response.outputStream.close(); | 96 response.outputStream.close(); |
88 }); | 97 }); |
89 | 98 |
90 expectLater(pub.nextErrLine(), equals('OAuth2 authorization failed (your ' | 99 expectLater(pub.nextErrLine(), equals('OAuth2 authorization failed (your ' |
91 'token sucks).')); | 100 'token sucks).')); |
92 expectLater(pub.nextLine(), equals('Pub needs your authorization to upload ' | 101 // TODO(rnystrom): The confirm line is run together with this one because |
93 'packages on your behalf.')); | 102 // in normal usage, the user will have entered a newline on stdin which |
| 103 // gets echoed to the terminal. Do something better here? |
| 104 expectLater(pub.nextLine(), equals( |
| 105 'Looks great! Are you ready to upload your package (y/n)? ' |
| 106 'Pub needs your authorization to upload packages on your behalf.')); |
94 pub.kill(); | 107 pub.kill(); |
95 | |
96 run(); | 108 run(); |
97 }); | 109 }); |
98 | 110 |
99 test('package validation has an error', () { | 111 test('package validation has an error', () { |
100 var package = package("test_pkg", "1.0.0"); | 112 var package = package("test_pkg", "1.0.0"); |
101 package.remove("homepage"); | 113 package.remove("homepage"); |
102 dir(appPath, [pubspec(package)]).scheduleCreate(); | 114 dir(appPath, [pubspec(package)]).scheduleCreate(); |
103 | 115 |
104 var server = new ScheduledServer(); | 116 var server = new ScheduledServer(); |
105 credentialsFile(server, 'access token').scheduleCreate(); | |
106 var pub = startPubLish(server); | 117 var pub = startPubLish(server); |
107 server.ignore('GET', '/packages/versions/new.json'); | |
108 | 118 |
109 pub.shouldExit(1); | 119 pub.shouldExit(1); |
110 expectLater(pub.remainingStderr(), contains("Package validation failed.")); | 120 expectLater(pub.remainingStderr(), |
| 121 contains("Sorry, your package is missing a requirement and can't be " |
| 122 "published yet.")); |
111 | 123 |
112 run(); | 124 run(); |
113 }); | 125 }); |
114 | 126 |
115 test('package validation has a warning and is canceled', () { | 127 test('package validation has a warning and is canceled', () { |
116 var package = package("test_pkg", "1.0.0"); | 128 var package = package("test_pkg", "1.0.0"); |
117 package["author"] = "Nathan Weizenbaum"; | 129 package["author"] = "Nathan Weizenbaum"; |
118 dir(appPath, [pubspec(package)]).scheduleCreate(); | 130 dir(appPath, [pubspec(package)]).scheduleCreate(); |
119 | 131 |
120 var server = new ScheduledServer(); | 132 var server = new ScheduledServer(); |
121 credentialsFile(server, 'access token').scheduleCreate(); | |
122 var pub = startPubLish(server); | 133 var pub = startPubLish(server); |
123 server.ignore('GET', '/packages/versions/new.json'); | |
124 | 134 |
125 pub.writeLine("n"); | 135 pub.writeLine("n"); |
126 pub.shouldExit(1); | 136 pub.shouldExit(1); |
127 expectLater(pub.remainingStderr(), contains("Package upload canceled.")); | 137 expectLater(pub.remainingStderr(), contains("Package upload canceled.")); |
128 | 138 |
129 run(); | 139 run(); |
130 }); | 140 }); |
131 | 141 |
132 test('package validation has a warning and continues', () { | 142 test('package validation has a warning and continues', () { |
133 var package = package("test_pkg", "1.0.0"); | 143 var package = package("test_pkg", "1.0.0"); |
(...skipping 19 matching lines...) Expand all Loading... |
153 contains('Package test_pkg 1.0.0 uploaded!')); | 163 contains('Package test_pkg 1.0.0 uploaded!')); |
154 | 164 |
155 run(); | 165 run(); |
156 }); | 166 }); |
157 | 167 |
158 test('upload form provides an error', () { | 168 test('upload form provides an error', () { |
159 var server = new ScheduledServer(); | 169 var server = new ScheduledServer(); |
160 credentialsFile(server, 'access token').scheduleCreate(); | 170 credentialsFile(server, 'access token').scheduleCreate(); |
161 var pub = startPubLish(server); | 171 var pub = startPubLish(server); |
162 | 172 |
| 173 confirmPublish(pub); |
| 174 |
163 server.handle('GET', '/packages/versions/new.json', (request, response) { | 175 server.handle('GET', '/packages/versions/new.json', (request, response) { |
164 response.statusCode = 400; | 176 response.statusCode = 400; |
165 response.outputStream.writeString(JSON.stringify({ | 177 response.outputStream.writeString(JSON.stringify({ |
166 'error': {'message': 'your request sucked'} | 178 'error': {'message': 'your request sucked'} |
167 })); | 179 })); |
168 response.outputStream.close(); | 180 response.outputStream.close(); |
169 }); | 181 }); |
170 | 182 |
171 expectLater(pub.nextErrLine(), equals('your request sucked')); | 183 expectLater(pub.nextErrLine(), equals('your request sucked')); |
172 pub.shouldExit(1); | 184 pub.shouldExit(1); |
173 | 185 |
174 run(); | 186 run(); |
175 }); | 187 }); |
176 | 188 |
177 test('upload form provides invalid JSON', () { | 189 test('upload form provides invalid JSON', () { |
178 var server = new ScheduledServer(); | 190 var server = new ScheduledServer(); |
179 credentialsFile(server, 'access token').scheduleCreate(); | 191 credentialsFile(server, 'access token').scheduleCreate(); |
180 var pub = startPubLish(server); | 192 var pub = startPubLish(server); |
181 | 193 |
| 194 confirmPublish(pub); |
| 195 |
182 server.handle('GET', '/packages/versions/new.json', (request, response) { | 196 server.handle('GET', '/packages/versions/new.json', (request, response) { |
183 response.outputStream.writeString('{not json'); | 197 response.outputStream.writeString('{not json'); |
184 response.outputStream.close(); | 198 response.outputStream.close(); |
185 }); | 199 }); |
186 | 200 |
187 expectLater(pub.nextErrLine(), equals('Invalid server response:')); | 201 expectLater(pub.nextErrLine(), equals('Invalid server response:')); |
188 expectLater(pub.nextErrLine(), equals('{not json')); | 202 expectLater(pub.nextErrLine(), equals('{not json')); |
189 pub.shouldExit(1); | 203 pub.shouldExit(1); |
190 | 204 |
191 run(); | 205 run(); |
192 }); | 206 }); |
193 | 207 |
194 test('upload form is missing url', () { | 208 test('upload form is missing url', () { |
195 var server = new ScheduledServer(); | 209 var server = new ScheduledServer(); |
196 credentialsFile(server, 'access token').scheduleCreate(); | 210 credentialsFile(server, 'access token').scheduleCreate(); |
197 var pub = startPubLish(server); | 211 var pub = startPubLish(server); |
198 | 212 |
| 213 confirmPublish(pub); |
| 214 |
199 var body = { | 215 var body = { |
200 'fields': { | 216 'fields': { |
201 'field1': 'value1', | 217 'field1': 'value1', |
202 'field2': 'value2' | 218 'field2': 'value2' |
203 } | 219 } |
204 }; | 220 }; |
205 | 221 |
206 handleUploadForm(server, body); | 222 handleUploadForm(server, body); |
207 expectLater(pub.nextErrLine(), equals('Invalid server response:')); | 223 expectLater(pub.nextErrLine(), equals('Invalid server response:')); |
208 expectLater(pub.nextErrLine(), equals(JSON.stringify(body))); | 224 expectLater(pub.nextErrLine(), equals(JSON.stringify(body))); |
209 pub.shouldExit(1); | 225 pub.shouldExit(1); |
210 | 226 |
211 run(); | 227 run(); |
212 }); | 228 }); |
213 | 229 |
214 test('upload form url is not a string', () { | 230 test('upload form url is not a string', () { |
215 var server = new ScheduledServer(); | 231 var server = new ScheduledServer(); |
216 credentialsFile(server, 'access token').scheduleCreate(); | 232 credentialsFile(server, 'access token').scheduleCreate(); |
217 var pub = startPubLish(server); | 233 var pub = startPubLish(server); |
218 | 234 |
| 235 confirmPublish(pub); |
| 236 |
219 var body = { | 237 var body = { |
220 'url': 12, | 238 'url': 12, |
221 'fields': { | 239 'fields': { |
222 'field1': 'value1', | 240 'field1': 'value1', |
223 'field2': 'value2' | 241 'field2': 'value2' |
224 } | 242 } |
225 }; | 243 }; |
226 | 244 |
227 handleUploadForm(server, body); | 245 handleUploadForm(server, body); |
228 expectLater(pub.nextErrLine(), equals('Invalid server response:')); | 246 expectLater(pub.nextErrLine(), equals('Invalid server response:')); |
229 expectLater(pub.nextErrLine(), equals(JSON.stringify(body))); | 247 expectLater(pub.nextErrLine(), equals(JSON.stringify(body))); |
230 pub.shouldExit(1); | 248 pub.shouldExit(1); |
231 | 249 |
232 run(); | 250 run(); |
233 }); | 251 }); |
234 | 252 |
235 test('upload form is missing fields', () { | 253 test('upload form is missing fields', () { |
236 var server = new ScheduledServer(); | 254 var server = new ScheduledServer(); |
237 credentialsFile(server, 'access token').scheduleCreate(); | 255 credentialsFile(server, 'access token').scheduleCreate(); |
238 var pub = startPubLish(server); | 256 var pub = startPubLish(server); |
239 | 257 |
| 258 confirmPublish(pub); |
| 259 |
240 var body = {'url': 'http://example.com/upload'}; | 260 var body = {'url': 'http://example.com/upload'}; |
241 handleUploadForm(server, body); | 261 handleUploadForm(server, body); |
242 expectLater(pub.nextErrLine(), equals('Invalid server response:')); | 262 expectLater(pub.nextErrLine(), equals('Invalid server response:')); |
243 expectLater(pub.nextErrLine(), equals(JSON.stringify(body))); | 263 expectLater(pub.nextErrLine(), equals(JSON.stringify(body))); |
244 pub.shouldExit(1); | 264 pub.shouldExit(1); |
245 | 265 |
246 run(); | 266 run(); |
247 }); | 267 }); |
248 | 268 |
249 test('upload form fields is not a map', () { | 269 test('upload form fields is not a map', () { |
250 var server = new ScheduledServer(); | 270 var server = new ScheduledServer(); |
251 credentialsFile(server, 'access token').scheduleCreate(); | 271 credentialsFile(server, 'access token').scheduleCreate(); |
252 var pub = startPubLish(server); | 272 var pub = startPubLish(server); |
253 | 273 |
| 274 confirmPublish(pub); |
| 275 |
254 var body = {'url': 'http://example.com/upload', 'fields': 12}; | 276 var body = {'url': 'http://example.com/upload', 'fields': 12}; |
255 handleUploadForm(server, body); | 277 handleUploadForm(server, body); |
256 expectLater(pub.nextErrLine(), equals('Invalid server response:')); | 278 expectLater(pub.nextErrLine(), equals('Invalid server response:')); |
257 expectLater(pub.nextErrLine(), equals(JSON.stringify(body))); | 279 expectLater(pub.nextErrLine(), equals(JSON.stringify(body))); |
258 pub.shouldExit(1); | 280 pub.shouldExit(1); |
259 | 281 |
260 run(); | 282 run(); |
261 }); | 283 }); |
262 | 284 |
263 test('upload form fields has a non-string value', () { | 285 test('upload form fields has a non-string value', () { |
264 var server = new ScheduledServer(); | 286 var server = new ScheduledServer(); |
265 credentialsFile(server, 'access token').scheduleCreate(); | 287 credentialsFile(server, 'access token').scheduleCreate(); |
266 var pub = startPubLish(server); | 288 var pub = startPubLish(server); |
267 | 289 |
| 290 confirmPublish(pub); |
| 291 |
268 var body = { | 292 var body = { |
269 'url': 'http://example.com/upload', | 293 'url': 'http://example.com/upload', |
270 'fields': {'field': 12} | 294 'fields': {'field': 12} |
271 }; | 295 }; |
272 handleUploadForm(server, body); | 296 handleUploadForm(server, body); |
273 expectLater(pub.nextErrLine(), equals('Invalid server response:')); | 297 expectLater(pub.nextErrLine(), equals('Invalid server response:')); |
274 expectLater(pub.nextErrLine(), equals(JSON.stringify(body))); | 298 expectLater(pub.nextErrLine(), equals(JSON.stringify(body))); |
275 pub.shouldExit(1); | 299 pub.shouldExit(1); |
276 | 300 |
277 run(); | 301 run(); |
278 }); | 302 }); |
279 | 303 |
280 test('cloud storage upload provides an error', () { | 304 test('cloud storage upload provides an error', () { |
281 var server = new ScheduledServer(); | 305 var server = new ScheduledServer(); |
282 credentialsFile(server, 'access token').scheduleCreate(); | 306 credentialsFile(server, 'access token').scheduleCreate(); |
283 var pub = startPubLish(server); | 307 var pub = startPubLish(server); |
| 308 |
| 309 confirmPublish(pub); |
284 handleUploadForm(server); | 310 handleUploadForm(server); |
285 | 311 |
286 server.handle('POST', '/upload', (request, response) { | 312 server.handle('POST', '/upload', (request, response) { |
287 response.statusCode = 400; | 313 response.statusCode = 400; |
288 response.headers.contentType = new ContentType('application', 'xml'); | 314 response.headers.contentType = new ContentType('application', 'xml'); |
289 response.outputStream.writeString('<Error><Message>Your request sucked.' | 315 response.outputStream.writeString('<Error><Message>Your request sucked.' |
290 '</Message></Error>'); | 316 '</Message></Error>'); |
291 response.outputStream.close(); | 317 response.outputStream.close(); |
292 }); | 318 }); |
293 | 319 |
294 // TODO(nweiz): This should use the server's error message once the client | 320 // TODO(nweiz): This should use the server's error message once the client |
295 // can parse the XML. | 321 // can parse the XML. |
296 expectLater(pub.nextErrLine(), equals('Failed to upload the package.')); | 322 expectLater(pub.nextErrLine(), equals('Failed to upload the package.')); |
297 pub.shouldExit(1); | 323 pub.shouldExit(1); |
298 | 324 |
299 run(); | 325 run(); |
300 }); | 326 }); |
301 | 327 |
302 test("cloud storage upload doesn't redirect", () { | 328 test("cloud storage upload doesn't redirect", () { |
303 var server = new ScheduledServer(); | 329 var server = new ScheduledServer(); |
304 credentialsFile(server, 'access token').scheduleCreate(); | 330 credentialsFile(server, 'access token').scheduleCreate(); |
305 var pub = startPubLish(server); | 331 var pub = startPubLish(server); |
| 332 |
| 333 confirmPublish(pub); |
306 handleUploadForm(server); | 334 handleUploadForm(server); |
307 | 335 |
308 server.handle('POST', '/upload', (request, response) { | 336 server.handle('POST', '/upload', (request, response) { |
309 // don't set the location header | 337 // don't set the location header |
310 response.outputStream.close(); | 338 response.outputStream.close(); |
311 }); | 339 }); |
312 | 340 |
313 expectLater(pub.nextErrLine(), equals('Failed to upload the package.')); | 341 expectLater(pub.nextErrLine(), equals('Failed to upload the package.')); |
314 pub.shouldExit(1); | 342 pub.shouldExit(1); |
315 | 343 |
316 run(); | 344 run(); |
317 }); | 345 }); |
318 | 346 |
319 test('package creation provides an error', () { | 347 test('package creation provides an error', () { |
320 var server = new ScheduledServer(); | 348 var server = new ScheduledServer(); |
321 credentialsFile(server, 'access token').scheduleCreate(); | 349 credentialsFile(server, 'access token').scheduleCreate(); |
322 var pub = startPubLish(server); | 350 var pub = startPubLish(server); |
| 351 |
| 352 confirmPublish(pub); |
323 handleUploadForm(server); | 353 handleUploadForm(server); |
324 handleUpload(server); | 354 handleUpload(server); |
325 | 355 |
326 server.handle('GET', '/create', (request, response) { | 356 server.handle('GET', '/create', (request, response) { |
327 response.statusCode = 400; | 357 response.statusCode = 400; |
328 response.outputStream.writeString(JSON.stringify({ | 358 response.outputStream.writeString(JSON.stringify({ |
329 'error': {'message': 'Your package was too boring.'} | 359 'error': {'message': 'Your package was too boring.'} |
330 })); | 360 })); |
331 response.outputStream.close(); | 361 response.outputStream.close(); |
332 }); | 362 }); |
333 | 363 |
334 expectLater(pub.nextErrLine(), equals('Your package was too boring.')); | 364 expectLater(pub.nextErrLine(), equals('Your package was too boring.')); |
335 pub.shouldExit(1); | 365 pub.shouldExit(1); |
336 | 366 |
337 run(); | 367 run(); |
338 }); | 368 }); |
339 | 369 |
340 test('package creation provides invalid JSON', () { | 370 test('package creation provides invalid JSON', () { |
341 var server = new ScheduledServer(); | 371 var server = new ScheduledServer(); |
342 credentialsFile(server, 'access token').scheduleCreate(); | 372 credentialsFile(server, 'access token').scheduleCreate(); |
343 var pub = startPubLish(server); | 373 var pub = startPubLish(server); |
| 374 |
| 375 confirmPublish(pub); |
344 handleUploadForm(server); | 376 handleUploadForm(server); |
345 handleUpload(server); | 377 handleUpload(server); |
346 | 378 |
347 server.handle('GET', '/create', (request, response) { | 379 server.handle('GET', '/create', (request, response) { |
348 response.outputStream.writeString('{not json'); | 380 response.outputStream.writeString('{not json'); |
349 response.outputStream.close(); | 381 response.outputStream.close(); |
350 }); | 382 }); |
351 | 383 |
352 expectLater(pub.nextErrLine(), equals('Invalid server response:')); | 384 expectLater(pub.nextErrLine(), equals('Invalid server response:')); |
353 expectLater(pub.nextErrLine(), equals('{not json')); | 385 expectLater(pub.nextErrLine(), equals('{not json')); |
354 pub.shouldExit(1); | 386 pub.shouldExit(1); |
355 | 387 |
356 run(); | 388 run(); |
357 }); | 389 }); |
358 | 390 |
359 test('package creation provides a malformed error', () { | 391 test('package creation provides a malformed error', () { |
360 var server = new ScheduledServer(); | 392 var server = new ScheduledServer(); |
361 credentialsFile(server, 'access token').scheduleCreate(); | 393 credentialsFile(server, 'access token').scheduleCreate(); |
362 var pub = startPubLish(server); | 394 var pub = startPubLish(server); |
| 395 |
| 396 confirmPublish(pub); |
363 handleUploadForm(server); | 397 handleUploadForm(server); |
364 handleUpload(server); | 398 handleUpload(server); |
365 | 399 |
366 var body = {'error': 'Your package was too boring.'}; | 400 var body = {'error': 'Your package was too boring.'}; |
367 server.handle('GET', '/create', (request, response) { | 401 server.handle('GET', '/create', (request, response) { |
368 response.statusCode = 400; | 402 response.statusCode = 400; |
369 response.outputStream.writeString(JSON.stringify(body)); | 403 response.outputStream.writeString(JSON.stringify(body)); |
370 response.outputStream.close(); | 404 response.outputStream.close(); |
371 }); | 405 }); |
372 | 406 |
373 expectLater(pub.nextErrLine(), equals('Invalid server response:')); | 407 expectLater(pub.nextErrLine(), equals('Invalid server response:')); |
374 expectLater(pub.nextErrLine(), equals(JSON.stringify(body))); | 408 expectLater(pub.nextErrLine(), equals(JSON.stringify(body))); |
375 pub.shouldExit(1); | 409 pub.shouldExit(1); |
376 | 410 |
377 run(); | 411 run(); |
378 }); | 412 }); |
379 | 413 |
380 test('package creation provides a malformed success', () { | 414 test('package creation provides a malformed success', () { |
381 var server = new ScheduledServer(); | 415 var server = new ScheduledServer(); |
382 credentialsFile(server, 'access token').scheduleCreate(); | 416 credentialsFile(server, 'access token').scheduleCreate(); |
383 var pub = startPubLish(server); | 417 var pub = startPubLish(server); |
| 418 |
| 419 confirmPublish(pub); |
384 handleUploadForm(server); | 420 handleUploadForm(server); |
385 handleUpload(server); | 421 handleUpload(server); |
386 | 422 |
387 var body = {'success': 'Your package was awesome.'}; | 423 var body = {'success': 'Your package was awesome.'}; |
388 server.handle('GET', '/create', (request, response) { | 424 server.handle('GET', '/create', (request, response) { |
389 response.outputStream.writeString(JSON.stringify(body)); | 425 response.outputStream.writeString(JSON.stringify(body)); |
390 response.outputStream.close(); | 426 response.outputStream.close(); |
391 }); | 427 }); |
392 | 428 |
393 expectLater(pub.nextErrLine(), equals('Invalid server response:')); | 429 expectLater(pub.nextErrLine(), equals('Invalid server response:')); |
394 expectLater(pub.nextErrLine(), equals(JSON.stringify(body))); | 430 expectLater(pub.nextErrLine(), equals(JSON.stringify(body))); |
395 pub.shouldExit(1); | 431 pub.shouldExit(1); |
396 | 432 |
397 run(); | 433 run(); |
398 }); | 434 }); |
399 } | 435 } |
OLD | NEW |