OLD | NEW |
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:io'; | 5 import 'dart:io'; |
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 | 9 |
10 import '../../../pub/io.dart'; | 10 import '../../lib/src/io.dart'; |
11 import '../../../pub/utils.dart'; | 11 import '../../lib/src/utils.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 integration('with no credentials.json, authenticates and saves ' | 18 integration('with no credentials.json, authenticates and saves ' |
19 'credentials.json', () { | 19 'credentials.json', () { |
20 d.validPackage.create(); | 20 d.validPackage.create(); |
21 | 21 |
22 var server = new ScheduledServer(); | 22 var server = new ScheduledServer(); |
23 var pub = startPublish(server); | 23 var pub = startPublish(server); |
24 confirmPublish(pub); | 24 confirmPublish(pub); |
25 authorizePub(pub, server); | 25 authorizePub(pub, server); |
26 | 26 |
27 server.handle('GET', '/packages/versions/new.json', (request) { | 27 server.handle('GET', '/packages/versions/new.json', (request) { |
28 expect(request.headers.value('authorization'), | 28 expect(request.headers.value('authorization'), |
29 equals('Bearer access token')); | 29 equals('Bearer access token')); |
30 | 30 |
31 request.response.close(); | 31 request.response.close(); |
32 }); | 32 }); |
33 | 33 |
34 // After we give pub an invalid response, it should crash. We wait for it to | 34 // After we give pub an invalid response, it should crash. We wait for it to |
35 // do so rather than killing it so it'll write out the credentials file. | 35 // do so rather than killing it so it'll write out the credentials file. |
36 pub.shouldExit(1); | 36 pub.shouldExit(1); |
37 | 37 |
38 d.credentialsFile(server, 'access token').validate(); | 38 d.credentialsFile(server, 'access token').validate(); |
39 }); | 39 }); |
40 } | 40 } |
OLD | NEW |