| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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_uploader_test; | 5 library pub_uploader_test; |
| 6 | 6 |
| 7 import 'dart:convert'; | 7 import 'dart:convert'; |
| 8 | 8 |
| 9 import 'package:pub/src/exit_codes.dart' as exit_codes; | 9 import 'package:pub/src/exit_codes.dart' as exit_codes; |
| 10 import 'package:pub/src/utils.dart'; | 10 import 'package:pub/src/utils.dart'; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 '''; | 32 '''; |
| 33 | 33 |
| 34 ScheduledProcess startPubUploader(ScheduledServer server, List<String> args) { | 34 ScheduledProcess startPubUploader(ScheduledServer server, List<String> args) { |
| 35 var tokenEndpoint = server.url.then((url) => | 35 var tokenEndpoint = server.url.then((url) => |
| 36 url.resolve('/token').toString()); | 36 url.resolve('/token').toString()); |
| 37 args = flatten(['uploader', '--server', tokenEndpoint, args]); | 37 args = flatten(['uploader', '--server', tokenEndpoint, args]); |
| 38 return startPub(args: args, tokenEndpoint: tokenEndpoint); | 38 return startPub(args: args, tokenEndpoint: tokenEndpoint); |
| 39 } | 39 } |
| 40 | 40 |
| 41 main() { | 41 main() { |
| 42 initConfig(); | |
| 43 group('displays usage', () { | 42 group('displays usage', () { |
| 44 integration('when run with no arguments', () { | 43 integration('when run with no arguments', () { |
| 45 schedulePub(args: ['uploader'], | 44 schedulePub(args: ['uploader'], |
| 46 output: USAGE_STRING, exitCode: exit_codes.USAGE); | 45 output: USAGE_STRING, exitCode: exit_codes.USAGE); |
| 47 }); | 46 }); |
| 48 | 47 |
| 49 integration('when run with only a command', () { | 48 integration('when run with only a command', () { |
| 50 schedulePub(args: ['uploader', 'add'], | 49 schedulePub(args: ['uploader', 'add'], |
| 51 output: USAGE_STRING, exitCode: exit_codes.USAGE); | 50 output: USAGE_STRING, exitCode: exit_codes.USAGE); |
| 52 }); | 51 }); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 | 159 |
| 161 server.handle('DELETE', '/api/packages/pkg/uploaders/email', | 160 server.handle('DELETE', '/api/packages/pkg/uploaders/email', |
| 162 (request) => new shelf.Response.ok("{not json")); | 161 (request) => new shelf.Response.ok("{not json")); |
| 163 | 162 |
| 164 pub.stderr.expect(emitsLines( | 163 pub.stderr.expect(emitsLines( |
| 165 'Invalid server response:\n' | 164 'Invalid server response:\n' |
| 166 '{not json')); | 165 '{not json')); |
| 167 pub.shouldExit(1); | 166 pub.shouldExit(1); |
| 168 }); | 167 }); |
| 169 } | 168 } |
| OLD | NEW |