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

Side by Side Diff: utils/tests/pub/oauth2_test.dart

Issue 11474047: Validate that an uploaded package has a LICENSE file. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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
OLDNEW
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 oauth2_test; 5 library oauth2_test;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 import 'dart:json'; 8 import 'dart:json';
9 import 'dart:uri'; 9 import 'dart:uri';
10 10
11 import 'test_pub.dart'; 11 import 'test_pub.dart';
12 import '../../../pkg/http/lib/http.dart' as http; 12 import '../../../pkg/http/lib/http.dart' as http;
13 import '../../../pkg/unittest/lib/unittest.dart'; 13 import '../../../pkg/unittest/lib/unittest.dart';
14 import '../../pub/io.dart'; 14 import '../../pub/io.dart';
15 import '../../pub/utils.dart'; 15 import '../../pub/utils.dart';
16 16
17 main() { 17 main() {
18 setUp(() => dir(appPath, [libPubspec("test_pkg", "1.0.0")]).scheduleCreate()); 18 setUp(() {
19 dir(appPath, [
20 libPubspec("test_pkg", "1.0.0"),
21 file("LICENSE", "Eh, do what you want.")
22 ]).scheduleCreate();
23 });
19 24
20 test('with no credentials.json, authenticates and saves credentials.json', 25 test('with no credentials.json, authenticates and saves credentials.json',
21 () { 26 () {
22 var server = new ScheduledServer(); 27 var server = new ScheduledServer();
23 var pub = startPubLish(server); 28 var pub = startPubLish(server);
24 authorizePub(pub, server); 29 authorizePub(pub, server);
25 30
26 server.handle('GET', '/packages/versions/new.json', (request, response) { 31 server.handle('GET', '/packages/versions/new.json', (request, response) {
27 expect(request.headers.value('authorization'), 32 expect(request.headers.value('authorization'),
28 equals('Bearer access token')); 33 equals('Bearer access token'));
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 181
177 response.headers.contentType = new ContentType("application", "json"); 182 response.headers.contentType = new ContentType("application", "json");
178 response.outputStream.writeString(JSON.stringify({ 183 response.outputStream.writeString(JSON.stringify({
179 "access_token": accessToken, 184 "access_token": accessToken,
180 "token_type": "bearer" 185 "token_type": "bearer"
181 })); 186 }));
182 response.outputStream.close(); 187 response.outputStream.close();
183 }); 188 });
184 }); 189 });
185 } 190 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698