Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Side by Side Diff: utils/tests/pub/pub_lish_test.dart

Issue 11411273: Get curl uploads working on Mac. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix test. Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« utils/pub/curl_client.dart ('K') | « utils/pub/curl_client.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 run(); 197 run();
198 }); 198 });
199 199
200 test('cloud storage upload provides an error', () { 200 test('cloud storage upload provides an error', () {
201 var server = new ScheduledServer(); 201 var server = new ScheduledServer();
202 credentialsFile(server, 'access token').scheduleCreate(); 202 credentialsFile(server, 'access token').scheduleCreate();
203 var pub = startPubLish(server); 203 var pub = startPubLish(server);
204 handleUploadForm(server); 204 handleUploadForm(server);
205 205
206 server.handle('POST', '/upload', (request, response) { 206 server.handle('POST', '/upload', (request, response) {
207 response.statusCode = 400; 207 // TODO(rnystrom): HTTP requires that you don't start sending a response
nweiz 2012/11/30 01:19:45 It's probably worth mentioning that curl will actu
Bob Nystrom 2012/11/30 01:42:45 Done.
208 response.headers.contentType = new ContentType('application', 'xml'); 208 // until the request has been completely sent, but dart:io doesn't
209 response.outputStream.writeString('<Error><Message>Your request sucked.' 209 // ensure that (#7044). Workaround it by manually consuming the entire
210 '</Message></Error>'); 210 // input stream before we start responding.
211 return closeHttpResponse(request, response); 211 return consumeInputStream(request.inputStream).transform((_) {
212 response.statusCode = 400;
213 response.headers.contentType = new ContentType('application', 'xml');
214 response.outputStream.writeString('<Error><Message>Your request sucked.'
215 '</Message></Error>');
216 response.outputStream.close();
217 });
212 }); 218 });
213 219
214 // TODO(nweiz): This should use the server's error message once the client 220 // TODO(nweiz): This should use the server's error message once the client
215 // can parse the XML. 221 // can parse the XML.
216 expectLater(pub.nextErrLine(), equals('Failed to upload the package.')); 222 expectLater(pub.nextErrLine(), equals('Failed to upload the package.'));
217 pub.shouldExit(1); 223 pub.shouldExit(1);
218 224
219 run(); 225 run();
220 }); 226 });
221 227
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 return closeHttpResponse(request, response); 315 return closeHttpResponse(request, response);
310 }); 316 });
311 317
312 expectLater(pub.nextErrLine(), equals('Invalid server response:')); 318 expectLater(pub.nextErrLine(), equals('Invalid server response:'));
313 expectLater(pub.nextErrLine(), equals(JSON.stringify(body))); 319 expectLater(pub.nextErrLine(), equals(JSON.stringify(body)));
314 pub.shouldExit(1); 320 pub.shouldExit(1);
315 321
316 run(); 322 run();
317 }); 323 });
318 } 324 }
OLDNEW
« utils/pub/curl_client.dart ('K') | « utils/pub/curl_client.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698