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_tests; | 5 library pub_tests; |
6 | 6 |
7 import 'package:scheduled_test/scheduled_server.dart'; | 7 import 'package:scheduled_test/scheduled_server.dart'; |
8 import 'package:scheduled_test/scheduled_test.dart'; | 8 import 'package:scheduled_test/scheduled_test.dart'; |
9 import 'package:shelf/shelf.dart' as shelf; | 9 import 'package:shelf/shelf.dart' as shelf; |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 "hosted": { | 23 "hosted": { |
24 "name": "foo", | 24 "name": "foo", |
25 "url": server.url.then((url) => url.toString()) | 25 "url": server.url.then((url) => url.toString()) |
26 } | 26 } |
27 } | 27 } |
28 }).create(); | 28 }).create(); |
29 | 29 |
30 var pub = startPub(args: [command.name]); | 30 var pub = startPub(args: [command.name]); |
31 | 31 |
32 server.handle('GET', '/api/packages/foo', (request) { | 32 server.handle('GET', '/api/packages/foo', (request) { |
33 expect(request.headers['accept'], | 33 expect( |
| 34 request.headers['accept'], |
34 equals('application/vnd.pub.v2+json')); | 35 equals('application/vnd.pub.v2+json')); |
35 return new shelf.Response(200); | 36 return new shelf.Response(200); |
36 }); | 37 }); |
37 | 38 |
38 pub.kill(); | 39 pub.kill(); |
39 }); | 40 }); |
40 | 41 |
41 integration('prints a friendly error if the version is out-of-date', () { | 42 integration('prints a friendly error if the version is out-of-date', () { |
42 var server = new ScheduledServer(); | 43 var server = new ScheduledServer(); |
43 | 44 |
44 d.appDir({ | 45 d.appDir({ |
45 "foo": { | 46 "foo": { |
46 "hosted": { | 47 "hosted": { |
47 "name": "foo", | 48 "name": "foo", |
48 "url": server.url.then((url) => url.toString()) | 49 "url": server.url.then((url) => url.toString()) |
49 } | 50 } |
50 } | 51 } |
51 }).create(); | 52 }).create(); |
52 | 53 |
53 var pub = startPub(args: [command.name]); | 54 var pub = startPub(args: [command.name]); |
54 | 55 |
55 server.handle('GET', '/api/packages/foo', | 56 server.handle( |
| 57 'GET', |
| 58 '/api/packages/foo', |
56 (request) => new shelf.Response(406)); | 59 (request) => new shelf.Response(406)); |
57 | 60 |
58 pub.shouldExit(1); | 61 pub.shouldExit(1); |
59 | 62 |
60 pub.stderr.expect(emitsLines( | 63 pub.stderr.expect( |
61 "Pub 0.1.2+3 is incompatible with the current version of localhost.\n" | 64 emitsLines( |
62 "Upgrade pub to the latest version and try again.")); | 65 "Pub 0.1.2+3 is incompatible with the current version of localhost
.\n" |
| 66 "Upgrade pub to the latest version and try again.")); |
63 }); | 67 }); |
64 }); | 68 }); |
65 } | 69 } |
OLD | NEW |