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

Side by Side Diff: sdk/lib/_internal/pub_generated/test/oauth2/with_a_server_rejected_refresh_token_authenticates_again_test.dart

Issue 887223007: Revert "Use native async/await support in pub." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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
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 import 'dart:convert'; 5 import 'dart:convert';
6 6
7 import 'package:scheduled_test/scheduled_test.dart'; 7 import 'package:scheduled_test/scheduled_test.dart';
8 import 'package:scheduled_test/scheduled_server.dart'; 8 import 'package:scheduled_test/scheduled_server.dart';
9 import 'package:shelf/shelf.dart' as shelf; 9 import 'package:shelf/shelf.dart' as shelf;
10 10
11 import '../../lib/src/io.dart'; 11 import '../../lib/src/io.dart';
12 import '../descriptor.dart' as d; 12 import '../descriptor.dart' as d;
13 import '../test_pub.dart'; 13 import '../test_pub.dart';
14 import 'utils.dart'; 14 import 'utils.dart';
15 15
16 main() { 16 main() {
17 initConfig(); 17 initConfig();
18 // Regression test for issue 8849. 18 // Regression test for issue 8849.
19 integration('with a server-rejected refresh token, authenticates again and ' 19 integration(
20 'saves credentials.json', () { 20 'with a server-rejected refresh token, authenticates again and '
21 'saves credentials.json',
22 () {
21 d.validPackage.create(); 23 d.validPackage.create();
22 24
23 var server = new ScheduledServer(); 25 var server = new ScheduledServer();
24 d.credentialsFile(server, 'access token', 26 d.credentialsFile(
27 server,
28 'access token',
25 refreshToken: 'bad refresh token', 29 refreshToken: 'bad refresh token',
26 expiration: new DateTime.now().subtract(new Duration(hours: 1))) 30 expiration: new DateTime.now().subtract(new Duration(hours: 1))).create( );
27 .create();
28 31
29 var pub = startPublish(server); 32 var pub = startPublish(server);
30 33
31 confirmPublish(pub); 34 confirmPublish(pub);
32 35
33 server.handle('POST', '/token', (request) { 36 server.handle('POST', '/token', (request) {
34 return drainStream(request.read()).then((_) { 37 return drainStream(request.read()).then((_) {
35 return new shelf.Response(400, 38 return new shelf.Response(400, body: JSON.encode({
36 body: JSON.encode({"error": "invalid_request"}), 39 "error": "invalid_request"
37 headers: {'content-type': 'application/json'}); 40 }), headers: {
41 'content-type': 'application/json'
42 });
38 }); 43 });
39 }); 44 });
40 45
41 pub.stdout.expect(startsWith('Uploading...')); 46 pub.stdout.expect(startsWith('Uploading...'));
42 authorizePub(pub, server, 'new access token'); 47 authorizePub(pub, server, 'new access token');
43 48
44 server.handle('GET', '/api/packages/versions/new', (request) { 49 server.handle('GET', '/api/packages/versions/new', (request) {
45 expect(request.headers, 50 expect(
51 request.headers,
46 containsPair('authorization', 'Bearer new access token')); 52 containsPair('authorization', 'Bearer new access token'));
47 53
48 return new shelf.Response(200); 54 return new shelf.Response(200);
49 }); 55 });
50 56
51 pub.kill(); 57 pub.kill();
52 }); 58 });
53 } 59 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698