| // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| // for details. All rights reserved. Use of this source code is governed by a |
| // BSD-style license that can be found in the LICENSE file. |
| |
| import 'package:shelf/shelf.dart' as shelf; |
| import 'package:shelf_test_handler/shelf_test_handler.dart'; |
| import 'package:test/test.dart'; |
| |
| import '../descriptor.dart' as d; |
| import '../test_pub.dart'; |
| |
| void main() { |
| test('with a pre-existing credentials.json does not authenticate', () async { |
| await d.validPackage.create(); |
| |
| var server = await ShelfTestServer.create(); |
| await d.credentialsFile(server, 'access token').create(); |
| var pub = await startPublish(server); |
| await confirmPublish(pub); |
| |
| server.handler.expect('GET', '/api/packages/versions/new', (request) { |
| expect(request.headers, |
| containsPair('authorization', 'Bearer access token')); |
| |
| return shelf.Response(200); |
| }); |
| |
| await pub.kill(); |
| }); |
| } |