| Index: sdk/lib/_internal/pub_generated/test/pub_uploader_test.dart
|
| diff --git a/sdk/lib/_internal/pub/test/pub_uploader_test.dart b/sdk/lib/_internal/pub_generated/test/pub_uploader_test.dart
|
| similarity index 72%
|
| copy from sdk/lib/_internal/pub/test/pub_uploader_test.dart
|
| copy to sdk/lib/_internal/pub_generated/test/pub_uploader_test.dart
|
| index 89054ebbeec4017cf39c84b0149408a3ba31c2af..1047ede875a2f8bbf20851077e63c858d5eb999a 100644
|
| --- a/sdk/lib/_internal/pub/test/pub_uploader_test.dart
|
| +++ b/sdk/lib/_internal/pub_generated/test/pub_uploader_test.dart
|
| @@ -32,8 +32,8 @@ See http://dartlang.org/tools/pub/cmd/pub-uploader.html for detailed documentati
|
| ''';
|
|
|
| ScheduledProcess startPubUploader(ScheduledServer server, List<String> args) {
|
| - var tokenEndpoint = server.url.then((url) =>
|
| - url.resolve('/token').toString());
|
| + var tokenEndpoint =
|
| + server.url.then((url) => url.resolve('/token').toString());
|
| args = flatten(['uploader', '--server', tokenEndpoint, args]);
|
| return startPub(args: args, tokenEndpoint: tokenEndpoint);
|
| }
|
| @@ -42,18 +42,24 @@ main() {
|
| initConfig();
|
| group('displays usage', () {
|
| integration('when run with no arguments', () {
|
| - schedulePub(args: ['uploader'],
|
| - output: USAGE_STRING, exitCode: exit_codes.USAGE);
|
| + schedulePub(
|
| + args: ['uploader'],
|
| + output: USAGE_STRING,
|
| + exitCode: exit_codes.USAGE);
|
| });
|
|
|
| integration('when run with only a command', () {
|
| - schedulePub(args: ['uploader', 'add'],
|
| - output: USAGE_STRING, exitCode: exit_codes.USAGE);
|
| + schedulePub(
|
| + args: ['uploader', 'add'],
|
| + output: USAGE_STRING,
|
| + exitCode: exit_codes.USAGE);
|
| });
|
|
|
| integration('when run with an invalid command', () {
|
| - schedulePub(args: ['uploader', 'foo', 'email'],
|
| - output: USAGE_STRING, exitCode: exit_codes.USAGE);
|
| + schedulePub(
|
| + args: ['uploader', 'foo', 'email'],
|
| + output: USAGE_STRING,
|
| + exitCode: exit_codes.USAGE);
|
| });
|
| });
|
|
|
| @@ -67,8 +73,12 @@ main() {
|
| expect(body, equals('email=email'));
|
|
|
| return new shelf.Response.ok(JSON.encode({
|
| - 'success': {'message': 'Good job!'}
|
| - }), headers: {'content-type': 'application/json'});
|
| + 'success': {
|
| + 'message': 'Good job!'
|
| + }
|
| + }), headers: {
|
| + 'content-type': 'application/json'
|
| + });
|
| });
|
| });
|
|
|
| @@ -83,8 +93,12 @@ main() {
|
|
|
| server.handle('DELETE', '/api/packages/pkg/uploaders/email', (request) {
|
| return new shelf.Response.ok(JSON.encode({
|
| - 'success': {'message': 'Good job!'}
|
| - }), headers: {'content-type': 'application/json'});
|
| + 'success': {
|
| + 'message': 'Good job!'
|
| + }
|
| + }), headers: {
|
| + 'content-type': 'application/json'
|
| + });
|
| });
|
|
|
| pub.stdout.expect('Good job!');
|
| @@ -100,8 +114,12 @@ main() {
|
|
|
| server.handle('POST', '/api/packages/test_pkg/uploaders', (request) {
|
| return new shelf.Response.ok(JSON.encode({
|
| - 'success': {'message': 'Good job!'}
|
| - }), headers: {'content-type': 'application/json'});
|
| + 'success': {
|
| + 'message': 'Good job!'
|
| + }
|
| + }), headers: {
|
| + 'content-type': 'application/json'
|
| + });
|
| });
|
|
|
| pub.stdout.expect('Good job!');
|
| @@ -114,9 +132,13 @@ main() {
|
| var pub = startPubUploader(server, ['--package', 'pkg', 'add', 'email']);
|
|
|
| server.handle('POST', '/api/packages/pkg/uploaders', (request) {
|
| - return new shelf.Response(400,
|
| - body: JSON.encode({'error': {'message': 'Bad job!'}}),
|
| - headers: {'content-type': 'application/json'});
|
| + return new shelf.Response(400, body: JSON.encode({
|
| + 'error': {
|
| + 'message': 'Bad job!'
|
| + }
|
| + }), headers: {
|
| + 'content-type': 'application/json'
|
| + });
|
| });
|
|
|
| pub.stderr.expect('Bad job!');
|
| @@ -126,13 +148,17 @@ main() {
|
| integration('remove provides an error', () {
|
| var server = new ScheduledServer();
|
| d.credentialsFile(server, 'access token').create();
|
| - var pub = startPubUploader(server,
|
| - ['--package', 'pkg', 'remove', 'e/mail']);
|
| + var pub =
|
| + startPubUploader(server, ['--package', 'pkg', 'remove', 'e/mail']);
|
|
|
| server.handle('DELETE', '/api/packages/pkg/uploaders/e%2Fmail', (request) {
|
| - return new shelf.Response(400,
|
| - body: JSON.encode({'error': {'message': 'Bad job!'}}),
|
| - headers: {'content-type': 'application/json'});
|
| + return new shelf.Response(400, body: JSON.encode({
|
| + 'error': {
|
| + 'message': 'Bad job!'
|
| + }
|
| + }), headers: {
|
| + 'content-type': 'application/json'
|
| + });
|
| });
|
|
|
| pub.stderr.expect('Bad job!');
|
| @@ -144,12 +170,12 @@ main() {
|
| d.credentialsFile(server, 'access token').create();
|
| var pub = startPubUploader(server, ['--package', 'pkg', 'add', 'email']);
|
|
|
| - server.handle('POST', '/api/packages/pkg/uploaders',
|
| + server.handle(
|
| + 'POST',
|
| + '/api/packages/pkg/uploaders',
|
| (request) => new shelf.Response.ok("{not json"));
|
|
|
| - pub.stderr.expect(emitsLines(
|
| - 'Invalid server response:\n'
|
| - '{not json'));
|
| + pub.stderr.expect(emitsLines('Invalid server response:\n' '{not json'));
|
| pub.shouldExit(1);
|
| });
|
|
|
| @@ -158,12 +184,12 @@ main() {
|
| d.credentialsFile(server, 'access token').create();
|
| var pub = startPubUploader(server, ['--package', 'pkg', 'remove', 'email']);
|
|
|
| - server.handle('DELETE', '/api/packages/pkg/uploaders/email',
|
| + server.handle(
|
| + 'DELETE',
|
| + '/api/packages/pkg/uploaders/email',
|
| (request) => new shelf.Response.ok("{not json"));
|
|
|
| - pub.stderr.expect(emitsLines(
|
| - 'Invalid server response:\n'
|
| - '{not json'));
|
| + pub.stderr.expect(emitsLines('Invalid server response:\n' '{not json'));
|
| pub.shouldExit(1);
|
| });
|
| }
|
|
|