Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 library pub_tests; | |
| 6 | |
| 7 import 'dart:io'; | |
| 8 | |
| 9 import 'package:scheduled_test/scheduled_server.dart'; | |
| 10 import 'package:scheduled_test/scheduled_test.dart'; | |
| 11 | |
| 12 import '../descriptor.dart' as d; | |
| 13 import '../test_pub.dart'; | |
| 14 | |
| 15 main() { | |
| 16 initConfig(); | |
| 17 | |
| 18 forBothPubInstallAndUpdate((command) { | |
| 19 integration('sends the correct Accept header', () { | |
| 20 var server = new ScheduledServer(); | |
| 21 | |
| 22 d.appDir([{ | |
| 23 "hosted": { | |
| 24 "name": "foo", | |
| 25 "url": server.url.then((url) => url.toString()) | |
| 26 } | |
| 27 }]).create(); | |
| 28 | |
| 29 var pub = startPub(args: [command.name]); | |
| 30 | |
| 31 server.handle('GET', '/api/packages/foo', (request) { | |
| 32 expect(request.headers['Accept'], ['application/vnd.pub.v2+json']); | |
| 33 }); | |
| 34 | |
| 35 pub.kill(); | |
| 36 }); | |
| 37 }); | |
| 38 | |
| 39 forBothPubInstallAndUpdate((command) { | |
|
Bob Nystrom
2013/06/04 20:21:41
Other tests just wrap all of the integration() cal
nweiz
2013/06/04 21:04:17
Done.
| |
| 40 integration('prints a user-friendly error if the version is out-of-date', | |
|
Bob Nystrom
2013/06/04 20:21:41
"user-friendly" -> "friendly", just to get rid of
nweiz
2013/06/04 21:04:17
Done.
| |
| 41 () { | |
| 42 var server = new ScheduledServer(); | |
| 43 | |
| 44 d.appDir([{ | |
| 45 "hosted": { | |
| 46 "name": "foo", | |
| 47 "url": server.url.then((url) => url.toString()) | |
| 48 } | |
| 49 }]).create(); | |
| 50 | |
| 51 var pub = startPub(args: [command.name]); | |
| 52 | |
| 53 server.handle('GET', '/api/packages/foo', (request) { | |
| 54 request.response.statusCode = 406; | |
| 55 request.response.close(); | |
| 56 }); | |
| 57 | |
| 58 // TODO(nweiz): this shouldn't request the versions twice (issue 11077). | |
| 59 server.handle('GET', '/api/packages/foo', (request) { | |
| 60 request.response.statusCode = 406; | |
| 61 request.response.close(); | |
| 62 }); | |
| 63 | |
| 64 pub.shouldExit(1); | |
| 65 | |
| 66 expect(pub.remainingStderr(), completion(equals( | |
| 67 "Pub 0.1.2+3 is incompatible with the current version of " | |
| 68 "pub.dartlang.org.\n" | |
|
Bob Nystrom
2013/06/04 20:21:41
Shouldn't it use the actual server URL here?
nweiz
2013/06/04 21:04:17
Done.
| |
| 69 "Upgrade pub to the latest version and try again."))); | |
| 70 }); | |
| 71 }); | |
| 72 } | |
| OLD | NEW |