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 import 'dart:convert'; | 5 import 'dart:convert'; |
6 | 6 |
7 import 'package:pub/src/exit_codes.dart' as exit_codes; | 7 import 'package:pub/src/exit_codes.dart' as exit_codes; |
8 import 'package:pub/src/utils.dart'; | 8 import 'package:pub/src/utils.dart'; |
9 import 'package:scheduled_test/scheduled_process.dart'; | 9 import 'package:scheduled_test/scheduled_process.dart'; |
10 import 'package:scheduled_test/scheduled_server.dart'; | 10 import 'package:scheduled_test/scheduled_server.dart'; |
(...skipping 14 matching lines...) Expand all Loading... |
25 --package The package whose uploaders will be modified. | 25 --package The package whose uploaders will be modified. |
26 (defaults to the current package) | 26 (defaults to the current package) |
27 | 27 |
28 Run "pub help" to see global options. | 28 Run "pub help" to see global options. |
29 See http://dartlang.org/tools/pub/cmd/pub-uploader.html for detailed documentati
on. | 29 See http://dartlang.org/tools/pub/cmd/pub-uploader.html for detailed documentati
on. |
30 '''; | 30 '''; |
31 | 31 |
32 ScheduledProcess startPubUploader(ScheduledServer server, List<String> args) { | 32 ScheduledProcess startPubUploader(ScheduledServer server, List<String> args) { |
33 var tokenEndpoint = server.url.then((url) => | 33 var tokenEndpoint = server.url.then((url) => |
34 url.resolve('/token').toString()); | 34 url.resolve('/token').toString()); |
35 args = flatten(['uploader', '--server', tokenEndpoint, args]); | 35 args = ['uploader', '--server', tokenEndpoint]..addAll(args); |
36 return startPub(args: args, tokenEndpoint: tokenEndpoint); | 36 return startPub(args: args, tokenEndpoint: tokenEndpoint); |
37 } | 37 } |
38 | 38 |
39 main() { | 39 main() { |
40 group('displays usage', () { | 40 group('displays usage', () { |
41 integration('when run with no arguments', () { | 41 integration('when run with no arguments', () { |
42 schedulePub(args: ['uploader'], | 42 schedulePub(args: ['uploader'], |
43 output: USAGE_STRING, exitCode: exit_codes.USAGE); | 43 output: USAGE_STRING, exitCode: exit_codes.USAGE); |
44 }); | 44 }); |
45 | 45 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 157 |
158 server.handle('DELETE', '/api/packages/pkg/uploaders/email', | 158 server.handle('DELETE', '/api/packages/pkg/uploaders/email', |
159 (request) => new shelf.Response.ok("{not json")); | 159 (request) => new shelf.Response.ok("{not json")); |
160 | 160 |
161 pub.stderr.expect(emitsLines( | 161 pub.stderr.expect(emitsLines( |
162 'Invalid server response:\n' | 162 'Invalid server response:\n' |
163 '{not json')); | 163 '{not json')); |
164 pub.shouldExit(1); | 164 pub.shouldExit(1); |
165 }); | 165 }); |
166 } | 166 } |
OLD | NEW |