OLD | NEW |
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'; |
11 import 'test_pub.dart'; | |
12 import '../../../pkg/unittest/lib/unittest.dart'; | 11 import '../../../pkg/unittest/lib/unittest.dart'; |
13 import '../../pub/io.dart'; | 12 import '../../pub/io.dart'; |
14 | 13 |
15 void handleUploadForm(ScheduledServer server, [Map body]) { | 14 void handleUploadForm(ScheduledServer server, [Map body]) { |
16 server.handle('GET', '/packages/versions/new.json', (request, response) { | 15 server.handle('GET', '/packages/versions/new.json', (request, response) { |
17 return server.url.then((url) { | 16 return server.url.then((url) { |
18 expect(request.headers.value('authorization'), | 17 expect(request.headers.value('authorization'), |
19 equals('Bearer access token')); | 18 equals('Bearer access token')); |
20 | 19 |
21 if (body == null) { | 20 if (body == null) { |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 server.handle('GET', '/create', (request, response) { | 363 server.handle('GET', '/create', (request, response) { |
365 response.outputStream.writeString(json.stringify(body)); | 364 response.outputStream.writeString(json.stringify(body)); |
366 response.outputStream.close(); | 365 response.outputStream.close(); |
367 }); | 366 }); |
368 | 367 |
369 expectLater(pub.nextErrLine(), equals('Invalid server response:')); | 368 expectLater(pub.nextErrLine(), equals('Invalid server response:')); |
370 expectLater(pub.nextErrLine(), equals(json.stringify(body))); | 369 expectLater(pub.nextErrLine(), equals(json.stringify(body))); |
371 pub.shouldExit(1); | 370 pub.shouldExit(1); |
372 }); | 371 }); |
373 } | 372 } |
OLD | NEW |