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

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
« no previous file with comments | « utils/pub/command_lish.dart ('k') | utils/tests/pub/pub_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_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(0);
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', () {
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 pub = startPubLish(server, args: ['--dry-run']);
104
105 pub.shouldExit(0);
106 expectLater(pub.remainingStderr(),
107 contains('Suggestions:\n* Author "Nathan Weizenbaum" in pubspec.yaml'
108 ' should have an email address\n'
109 ' (e.g. "name <email>").\n\n'
110 'Package has 1 warning.'));
111 });
112
113 integration('preview package validation has no warnings', () {
114 var pkg = package("test_pkg", "1.0.0");
115 pkg["author"] = "Nathan Weizenbaum <nweiz@google.com>";
116 dir(appPath, [pubspec(pkg)]).scheduleCreate();
117
118 var server = new ScheduledServer();
119 var pub = startPubLish(server, args: ['--dry-run']);
120
121 pub.shouldExit(0);
122 expectLater(pub.remainingStderr(),
123 contains('Package has 0 warnings.'));
124 });
125
97 integration('package validation has a warning and is canceled', () { 126 integration('package validation has a warning and is canceled', () {
98 var package = package("test_pkg", "1.0.0"); 127 var pkg = package("test_pkg", "1.0.0");
99 package["author"] = "Nathan Weizenbaum"; 128 pkg["author"] = "Nathan Weizenbaum";
100 dir(appPath, [pubspec(package)]).scheduleCreate(); 129 dir(appPath, [pubspec(pkg)]).scheduleCreate();
101 130
102 var server = new ScheduledServer(); 131 var server = new ScheduledServer();
103 var pub = startPubLish(server); 132 var pub = startPubLish(server);
104 133
105 pub.writeLine("n"); 134 pub.writeLine("n");
106 pub.shouldExit(1); 135 pub.shouldExit(0);
107 expectLater(pub.remainingStderr(), contains("Package upload canceled.")); 136 expectLater(pub.remainingStderr(), contains("Package upload canceled."));
108 }); 137 });
109 138
110 integration('package validation has a warning and continues', () { 139 integration('package validation has a warning and continues', () {
111 var package = package("test_pkg", "1.0.0"); 140 var pkg = package("test_pkg", "1.0.0");
112 package["author"] = "Nathan Weizenbaum"; 141 pkg["author"] = "Nathan Weizenbaum";
113 dir(appPath, [pubspec(package)]).scheduleCreate(); 142 dir(appPath, [pubspec(pkg)]).scheduleCreate();
114 143
115 var server = new ScheduledServer(); 144 var server = new ScheduledServer();
116 credentialsFile(server, 'access token').scheduleCreate(); 145 credentialsFile(server, 'access token').scheduleCreate();
117 var pub = startPubLish(server); 146 var pub = startPubLish(server);
118 pub.writeLine("y"); 147 pub.writeLine("y");
119 handleUploadForm(server); 148 handleUploadForm(server);
120 handleUpload(server); 149 handleUpload(server);
121 150
122 server.handle('GET', '/create', (request, response) { 151 server.handle('GET', '/create', (request, response) {
123 response.outputStream.writeString(json.stringify({ 152 response.outputStream.writeString(json.stringify({
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 server.handle('GET', '/create', (request, response) { 399 server.handle('GET', '/create', (request, response) {
371 response.outputStream.writeString(json.stringify(body)); 400 response.outputStream.writeString(json.stringify(body));
372 response.outputStream.close(); 401 response.outputStream.close();
373 }); 402 });
374 403
375 expectLater(pub.nextErrLine(), equals('Invalid server response:')); 404 expectLater(pub.nextErrLine(), equals('Invalid server response:'));
376 expectLater(pub.nextErrLine(), equals(json.stringify(body))); 405 expectLater(pub.nextErrLine(), equals(json.stringify(body)));
377 pub.shouldExit(1); 406 pub.shouldExit(1);
378 }); 407 });
379 } 408 }
OLDNEW
« no previous file with comments | « utils/pub/command_lish.dart ('k') | utils/tests/pub/pub_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698