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

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

Issue 12226077: add --preview flag to publish command (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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
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' as json; 8 import 'dart:json' as json;
9 9
10 import 'test_pub.dart'; 10 import 'test_pub.dart';
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 expectLater(pub.nextLine(), equals( 74 expectLater(pub.nextLine(), equals(
75 'Looks great! Are you ready to upload your package (y/n)?' 75 'Looks great! Are you ready to upload your package (y/n)?'
76 ' Package test_pkg 1.0.0 uploaded!')); 76 ' Package test_pkg 1.0.0 uploaded!'));
77 pub.shouldExit(0); 77 pub.shouldExit(0);
78 }); 78 });
79 79
80 // TODO(nweiz): Once a multipart/form-data parser in Dart exists, we should 80 // TODO(nweiz): Once a multipart/form-data parser in Dart exists, we should
81 // test that "pub lish" chooses the correct files to publish. 81 // test that "pub lish" chooses the correct files to publish.
82 82
83 integration('package validation has an error', () { 83 integration('package validation has an error', () {
84 var package = package("test_pkg", "1.0.0"); 84 var pkg = package("test_pkg", "1.0.0");
85 package.remove("homepage"); 85 pkg.remove("homepage");
86 dir(appPath, [pubspec(package)]).scheduleCreate(); 86 dir(appPath, [pubspec(pkg)]).scheduleCreate();
87 87
88 var server = new ScheduledServer(); 88 var server = new ScheduledServer();
89 var pub = startPubLish(server); 89 var pub = startPubLish(server);
90 90
91 pub.shouldExit(1); 91 pub.shouldExit(1);
92 expectLater(pub.remainingStderr(), 92 expectLater(pub.remainingStderr(),
93 contains("Sorry, your package is missing a requirement and can't be " 93 contains("Sorry, your package is missing a requirement and can't be "
94 "published yet.")); 94 "published yet."));
95 }); 95 });
96 96
97 integration('preview package validation has a warning', () {
nweiz 2013/02/09 00:20:50 It would be good to test the no-warnings case as w
keertip 2013/02/09 00:53:40 Done.
98 var pkg = package("test_pkg", "1.0.0");
99 pkg["author"] = "Nathan Weizenbaum";
100 dir(appPath, [pubspec(pkg)]).scheduleCreate();
101
102 var server = new ScheduledServer();
103 var lishArgs = new List();
104 lishArgs.add("--preview");
105 var pub = startPubLish(server,args: lishArgs);
106
107 pub.shouldExit(0);
108 expectLater(pub.remainingStderr(),
109 contains('Suggestions:\n* Author "Nathan Weizenbaum" in pubspec.yaml sho uld have an email address\n'
nweiz 2013/02/09 00:20:50 Line length
keertip 2013/02/09 00:53:40 Done.
110 ' (e.g. "name <email>").\n\n'
111 'Package has 1 warnings.'));
112 });
113
97 integration('package validation has a warning and is canceled', () { 114 integration('package validation has a warning and is canceled', () {
98 var package = package("test_pkg", "1.0.0"); 115 var pkg = package("test_pkg", "1.0.0");
99 package["author"] = "Nathan Weizenbaum"; 116 pkg["author"] = "Nathan Weizenbaum";
100 dir(appPath, [pubspec(package)]).scheduleCreate(); 117 dir(appPath, [pubspec(pkg)]).scheduleCreate();
101 118
102 var server = new ScheduledServer(); 119 var server = new ScheduledServer();
103 var pub = startPubLish(server); 120 var pub = startPubLish(server);
104 121
105 pub.writeLine("n"); 122 pub.writeLine("n");
106 pub.shouldExit(1); 123 pub.shouldExit(1);
107 expectLater(pub.remainingStderr(), contains("Package upload canceled.")); 124 expectLater(pub.remainingStderr(), contains("Package upload canceled."));
108 }); 125 });
109 126
110 integration('package validation has a warning and continues', () { 127 integration('package validation has a warning and continues', () {
111 var package = package("test_pkg", "1.0.0"); 128 var pkg = package("test_pkg", "1.0.0");
112 package["author"] = "Nathan Weizenbaum"; 129 pkg["author"] = "Nathan Weizenbaum";
113 dir(appPath, [pubspec(package)]).scheduleCreate(); 130 dir(appPath, [pubspec(pkg)]).scheduleCreate();
114 131
115 var server = new ScheduledServer(); 132 var server = new ScheduledServer();
116 credentialsFile(server, 'access token').scheduleCreate(); 133 credentialsFile(server, 'access token').scheduleCreate();
117 var pub = startPubLish(server); 134 var pub = startPubLish(server);
118 pub.writeLine("y"); 135 pub.writeLine("y");
119 handleUploadForm(server); 136 handleUploadForm(server);
120 handleUpload(server); 137 handleUpload(server);
121 138
122 server.handle('GET', '/create', (request, response) { 139 server.handle('GET', '/create', (request, response) {
123 response.outputStream.writeString(json.stringify({ 140 response.outputStream.writeString(json.stringify({
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 server.handle('GET', '/create', (request, response) { 387 server.handle('GET', '/create', (request, response) {
371 response.outputStream.writeString(json.stringify(body)); 388 response.outputStream.writeString(json.stringify(body));
372 response.outputStream.close(); 389 response.outputStream.close();
373 }); 390 });
374 391
375 expectLater(pub.nextErrLine(), equals('Invalid server response:')); 392 expectLater(pub.nextErrLine(), equals('Invalid server response:'));
376 expectLater(pub.nextErrLine(), equals(json.stringify(body))); 393 expectLater(pub.nextErrLine(), equals(json.stringify(body)));
377 pub.shouldExit(1); 394 pub.shouldExit(1);
378 }); 395 });
379 } 396 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698