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

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

Issue 12036065: Make pub use the SDK's "version" file for its version. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Comment regex. Created 7 years, 11 months 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
« no previous file with comments | « utils/tests/pub/pub_test.dart ('k') | utils/tests/pub/real_version_test.dart » ('j') | 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_uploader_test; 5 library pub_uploader_test;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 import 'dart:json' as json; 8 import 'dart:json' as json;
9 9
10 import 'test_pub.dart'; 10 import 'test_pub.dart';
(...skipping 14 matching lines...) Expand all
25 25
26 ScheduledProcess startPubUploader(ScheduledServer server, List<String> args) { 26 ScheduledProcess startPubUploader(ScheduledServer server, List<String> args) {
27 var tokenEndpoint = server.url.then((url) => 27 var tokenEndpoint = server.url.then((url) =>
28 url.resolve('/token').toString()); 28 url.resolve('/token').toString());
29 args = flatten(['uploader', '--server', tokenEndpoint, args]); 29 args = flatten(['uploader', '--server', tokenEndpoint, args]);
30 return startPub(args: args, tokenEndpoint: tokenEndpoint); 30 return startPub(args: args, tokenEndpoint: tokenEndpoint);
31 } 31 }
32 32
33 main() { 33 main() {
34 group('displays usage', () { 34 group('displays usage', () {
35 test('when run with no arguments', () => 35 integration('when run with no arguments', () {
36 runPub(args: ['uploader'], output: USAGE_STRING, exitCode: 64)); 36 schedulePub(args: ['uploader'],
37 output: USAGE_STRING, exitCode: 64);
38 });
37 39
38 test('when run with only a command', () => 40 integration('when run with only a command', () {
39 runPub(args: ['uploader', 'add'], output: USAGE_STRING, exitCode: 64)); 41 schedulePub(args: ['uploader', 'add'],
42 output: USAGE_STRING, exitCode: 64);
43 });
40 44
41 test('when run with an invalid command', () => runPub( 45 integration('when run with an invalid command', () {
42 args: ['uploader', 'foo', 'email'], 46 schedulePub(args: ['uploader', 'foo', 'email'],
43 output: USAGE_STRING, exitCode: 64)); 47 output: USAGE_STRING, exitCode: 64);
48 });
44 }); 49 });
45 50
46 integration('adds an uploader', () { 51 integration('adds an uploader', () {
47 var server = new ScheduledServer(); 52 var server = new ScheduledServer();
48 credentialsFile(server, 'access token').scheduleCreate(); 53 credentialsFile(server, 'access token').scheduleCreate();
49 var pub = startPubUploader(server, ['--package', 'pkg', 'add', 'email']); 54 var pub = startPubUploader(server, ['--package', 'pkg', 'add', 'email']);
50 55
51 server.handle('POST', '/packages/pkg/uploaders.json', (request, response) { 56 server.handle('POST', '/packages/pkg/uploaders.json', (request, response) {
52 expect(consumeInputStream(request.inputStream).then((bodyBytes) { 57 expect(consumeInputStream(request.inputStream).then((bodyBytes) {
53 expect(new String.fromCharCodes(bodyBytes), equals('email=email')); 58 expect(new String.fromCharCodes(bodyBytes), equals('email=email'));
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 (request, response) { 169 (request, response) {
165 response.outputStream.writeString("{not json"); 170 response.outputStream.writeString("{not json");
166 response.outputStream.close(); 171 response.outputStream.close();
167 }); 172 });
168 173
169 expectLater(pub.nextErrLine(), equals('Invalid server response:')); 174 expectLater(pub.nextErrLine(), equals('Invalid server response:'));
170 expectLater(pub.nextErrLine(), equals('{not json')); 175 expectLater(pub.nextErrLine(), equals('{not json'));
171 pub.shouldExit(1); 176 pub.shouldExit(1);
172 }); 177 });
173 } 178 }
OLDNEW
« no previous file with comments | « utils/tests/pub/pub_test.dart ('k') | utils/tests/pub/real_version_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698