| 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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 }); | 237 }); |
| 238 | 238 |
| 239 test('package creation provides an error', () { | 239 test('package creation provides an error', () { |
| 240 var server = new ScheduledServer(); | 240 var server = new ScheduledServer(); |
| 241 credentialsFile(server, 'access token').scheduleCreate(); | 241 credentialsFile(server, 'access token').scheduleCreate(); |
| 242 var pub = startPubLish(server); | 242 var pub = startPubLish(server); |
| 243 handleUploadForm(server); | 243 handleUploadForm(server); |
| 244 handleUpload(server); | 244 handleUpload(server); |
| 245 | 245 |
| 246 server.handle('GET', '/create', (request, response) { | 246 server.handle('GET', '/create', (request, response) { |
| 247 response.statusCode = 400; |
| 247 response.outputStream.writeString(JSON.stringify({ | 248 response.outputStream.writeString(JSON.stringify({ |
| 248 'error': {'message': 'Your package was too boring.'} | 249 'error': {'message': 'Your package was too boring.'} |
| 249 })); | 250 })); |
| 250 return closeHttpResponse(request, response); | 251 return closeHttpResponse(request, response); |
| 251 }); | 252 }); |
| 252 | 253 |
| 253 expectLater(pub.nextErrLine(), equals('Your package was too boring.')); | 254 expectLater(pub.nextErrLine(), equals('Your package was too boring.')); |
| 254 pub.shouldExit(1); | 255 pub.shouldExit(1); |
| 255 | 256 |
| 256 run(); | 257 run(); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 return closeHttpResponse(request, response); | 310 return closeHttpResponse(request, response); |
| 310 }); | 311 }); |
| 311 | 312 |
| 312 expectLater(pub.nextErrLine(), equals('Invalid server response:')); | 313 expectLater(pub.nextErrLine(), equals('Invalid server response:')); |
| 313 expectLater(pub.nextErrLine(), equals(JSON.stringify(body))); | 314 expectLater(pub.nextErrLine(), equals(JSON.stringify(body))); |
| 314 pub.shouldExit(1); | 315 pub.shouldExit(1); |
| 315 | 316 |
| 316 run(); | 317 run(); |
| 317 }); | 318 }); |
| 318 } | 319 } |
| OLD | NEW |