| Index: test/hosted/offline_test.dart
|
| diff --git a/test/hosted/offline_test.dart b/test/hosted/offline_test.dart
|
| index 845c16ea184fd8a74d8c85d345db9ae7f776a161..36176fa8a6422b929a7b7f9f3f92cf8cc1ca8669 100644
|
| --- a/test/hosted/offline_test.dart
|
| +++ b/test/hosted/offline_test.dart
|
| @@ -4,6 +4,8 @@
|
|
|
| library pub_tests;
|
|
|
| +import 'package:pub/src/exit_codes.dart' as exit_codes;
|
| +
|
| import '../descriptor.dart' as d;
|
| import '../test_pub.dart';
|
|
|
| @@ -11,7 +13,7 @@ main() {
|
| forBothPubGetAndUpgrade((command) {
|
| integration('upgrades a package using the cache', () {
|
| // Run the server so that we know what URL to use in the system cache.
|
| - serveNoPackages();
|
| + serveErrors();
|
|
|
| d.cacheDir({
|
| "foo": ["1.2.2", "1.2.3"],
|
| @@ -39,17 +41,20 @@ main() {
|
|
|
| integration('fails gracefully if a dependency is not cached', () {
|
| // Run the server so that we know what URL to use in the system cache.
|
| - serveNoPackages();
|
| + serveErrors();
|
|
|
| d.appDir({"foo": "any"}).create();
|
|
|
| pubCommand(command, args: ['--offline'],
|
| - error: "Could not find package foo in cache.");
|
| + exitCode: exit_codes.UNAVAILABLE,
|
| + error: "Could not find package foo in cache.\n"
|
| + "Depended on by:\n"
|
| + "- myapp");
|
| });
|
|
|
| - integration('fails gracefully no cached versions match', () {
|
| + integration('fails gracefully if no cached versions match', () {
|
| // Run the server so that we know what URL to use in the system cache.
|
| - serveNoPackages();
|
| + serveErrors();
|
|
|
| d.cacheDir({
|
| "foo": ["1.2.2", "1.2.3"]
|
| @@ -61,5 +66,38 @@ main() {
|
| "Package foo has no versions that match >2.0.0 derived from:\n"
|
| "- myapp depends on version >2.0.0");
|
| });
|
| +
|
| + integration('fails gracefully if a dependency is not cached and a lockfile '
|
| + 'exists', () {
|
| + // Run the server so that we know what URL to use in the system cache.
|
| + serveErrors();
|
| +
|
| + d.appDir({"foo": "any"}).create();
|
| +
|
| + createLockFile('myapp', hosted: {'foo': '1.2.4'});
|
| +
|
| + pubCommand(command, args: ['--offline'],
|
| + exitCode: exit_codes.UNAVAILABLE,
|
| + error: "Could not find package foo in cache.\n"
|
| + "Depended on by:\n"
|
| + "- myapp");
|
| + });
|
| +
|
| + integration('downgrades to the version in the cache if necessary', () {
|
| + // Run the server so that we know what URL to use in the system cache.
|
| + serveErrors();
|
| +
|
| + d.cacheDir({
|
| + "foo": ["1.2.2", "1.2.3"]
|
| + }, includePubspecs: true).create();
|
| +
|
| + d.appDir({"foo": "any"}).create();
|
| +
|
| + createLockFile('myapp', hosted: {'foo': '1.2.4'});
|
| +
|
| + pubCommand(command, args: ['--offline']);
|
| +
|
| + d.packagesDir({"foo": "1.2.3"}).validate();
|
| + });
|
| });
|
| }
|
|
|