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'; | 8 import 'dart:json'; |
9 | 9 |
10 import 'test_pub.dart'; | 10 import 'test_pub.dart'; |
(...skipping 29 matching lines...) Loading... |
40 // that the request body is correctly formatted. See issue 6952. | 40 // that the request body is correctly formatted. See issue 6952. |
41 return server.url.chain((url) { | 41 return server.url.chain((url) { |
42 response.statusCode = 302; | 42 response.statusCode = 302; |
43 response.headers.set('location', url.resolve('/create').toString()); | 43 response.headers.set('location', url.resolve('/create').toString()); |
44 return closeHttpResponse(request, response); | 44 return closeHttpResponse(request, response); |
45 }); | 45 }); |
46 }); | 46 }); |
47 } | 47 } |
48 | 48 |
49 main() { | 49 main() { |
50 setUp(() => dir(appPath, [libPubspec("test_pkg", "1.0.0")]).scheduleCreate()); | 50 setUp(() { |
| 51 dir(appPath, [ |
| 52 libPubspec("test_pkg", "1.0.0"), |
| 53 file("LICENSE", "Eh, do what you want.") |
| 54 ]).scheduleCreate(); |
| 55 }); |
51 | 56 |
52 test('archives and uploads a package', () { | 57 test('archives and uploads a package', () { |
53 var server = new ScheduledServer(); | 58 var server = new ScheduledServer(); |
54 credentialsFile(server, 'access token').scheduleCreate(); | 59 credentialsFile(server, 'access token').scheduleCreate(); |
55 var pub = startPubLish(server); | 60 var pub = startPubLish(server); |
56 handleUploadForm(server); | 61 handleUploadForm(server); |
57 handleUpload(server); | 62 handleUpload(server); |
58 | 63 |
59 server.handle('GET', '/create', (request, response) { | 64 server.handle('GET', '/create', (request, response) { |
60 response.outputStream.writeString(JSON.stringify({ | 65 response.outputStream.writeString(JSON.stringify({ |
(...skipping 329 matching lines...) Loading... |
390 return closeHttpResponse(request, response); | 395 return closeHttpResponse(request, response); |
391 }); | 396 }); |
392 | 397 |
393 expectLater(pub.nextErrLine(), equals('Invalid server response:')); | 398 expectLater(pub.nextErrLine(), equals('Invalid server response:')); |
394 expectLater(pub.nextErrLine(), equals(JSON.stringify(body))); | 399 expectLater(pub.nextErrLine(), equals(JSON.stringify(body))); |
395 pub.shouldExit(1); | 400 pub.shouldExit(1); |
396 | 401 |
397 run(); | 402 run(); |
398 }); | 403 }); |
399 } | 404 } |
OLD | NEW |