Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: sdk/lib/_internal/pub/test/validator/dependency_test.dart

Issue 16351003: Move pub over to using the pub.dartlang.org API v2. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/_internal/pub/test/test_pub.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:json' as json; 6 import 'dart:json' as json;
7 7
8 import 'package:http/http.dart' as http; 8 import 'package:http/http.dart' as http;
9 import 'package:http/testing.dart'; 9 import 'package:http/testing.dart';
10 import 'package:pathos/path.dart' as path; 10 import 'package:pathos/path.dart' as path;
(...skipping 17 matching lines...) Expand all
28 expectDependencyValidationWarning(String warning) { 28 expectDependencyValidationWarning(String warning) {
29 expect(schedulePackageValidation(dependency), 29 expect(schedulePackageValidation(dependency),
30 completion(pairOf(isEmpty, someElement(contains(warning))))); 30 completion(pairOf(isEmpty, someElement(contains(warning)))));
31 } 31 }
32 32
33 /// Sets up a test package with dependency [dep] and mocks a server with 33 /// Sets up a test package with dependency [dep] and mocks a server with
34 /// [hostedVersions] of the package available. 34 /// [hostedVersions] of the package available.
35 setUpDependency(Map dep, {List<String> hostedVersions}) { 35 setUpDependency(Map dep, {List<String> hostedVersions}) {
36 useMockClient(new MockClient((request) { 36 useMockClient(new MockClient((request) {
37 expect(request.method, equals("GET")); 37 expect(request.method, equals("GET"));
38 expect(request.url.path, equals("/packages/foo.json")); 38 expect(request.url.path, equals("/api/packages/foo"));
39 39
40 if (hostedVersions == null) { 40 if (hostedVersions == null) {
41 return new Future.value(new http.Response("not found", 404)); 41 return new Future.value(new http.Response("not found", 404));
42 } else { 42 } else {
43 return new Future.value(new http.Response(json.stringify({ 43 return new Future.value(new http.Response(json.stringify({
44 "name": "foo", 44 "name": "foo",
45 "uploaders": ["nweiz@google.com"], 45 "uploaders": ["nweiz@google.com"],
46 "versions": hostedVersions 46 "versions": hostedVersions.map((version) =>
47 packageVersionApiMap(packageMap('foo', version))).toList()
47 }), 200)); 48 }), 200));
48 } 49 }
49 })); 50 }));
50 51
51 d.dir(appPath, [ 52 d.dir(appPath, [
52 d.libPubspec("test_pkg", "1.0.0", deps: [dep]) 53 d.libPubspec("test_pkg", "1.0.0", deps: [dep])
53 ]).create(); 54 ]).create();
54 } 55 }
55 56
56 main() { 57 main() {
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 d.dir(appPath, [ 242 d.dir(appPath, [
242 d.libPubspec("test_pkg", "1.0.0", deps: [ 243 d.libPubspec("test_pkg", "1.0.0", deps: [
243 {'hosted': {'name': 'test_pkg', 'version': '>=1.0.0'}} 244 {'hosted': {'name': 'test_pkg', 'version': '>=1.0.0'}}
244 ]) 245 ])
245 ]).create(); 246 ]).create();
246 247
247 expectValidationWarning(dependency); 248 expectValidationWarning(dependency);
248 }); 249 });
249 }); 250 });
250 } 251 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/pub/test/test_pub.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698