OLD | NEW |
| (Empty) |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 import 'dart:io'; | |
6 | |
7 import 'package:scheduled_test/scheduled_test.dart'; | |
8 import 'package:scheduled_test/scheduled_server.dart'; | |
9 | |
10 import '../../../pub/io.dart'; | |
11 import '../../../pub/utils.dart'; | |
12 import '../descriptor.dart' as d; | |
13 import '../test_pub.dart'; | |
14 import 'utils.dart'; | |
15 | |
16 main() { | |
17 initConfig(); | |
18 integration('with no credentials.json, authenticates and saves ' | |
19 'credentials.json', () { | |
20 d.validPackage.create(); | |
21 | |
22 var server = new ScheduledServer(); | |
23 var pub = startPublish(server); | |
24 confirmPublish(pub); | |
25 authorizePub(pub, server); | |
26 | |
27 server.handle('GET', '/packages/versions/new.json', (request) { | |
28 expect(request.headers.value('authorization'), | |
29 equals('Bearer access token')); | |
30 | |
31 request.response.close(); | |
32 }); | |
33 | |
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. | |
36 pub.shouldExit(1); | |
37 | |
38 d.credentialsFile(server, 'access token').validate(); | |
39 }); | |
40 } | |
OLD | NEW |