Chromium Code Reviews| Index: utils/tests/pub/pub_lish_test.dart |
| diff --git a/utils/tests/pub/pub_lish_test.dart b/utils/tests/pub/pub_lish_test.dart |
| index aa67161184e75eb01a9954e972d38cf9071d550c..165572a3856eaa6865683546bd233b274c46b4cf 100644 |
| --- a/utils/tests/pub/pub_lish_test.dart |
| +++ b/utils/tests/pub/pub_lish_test.dart |
| @@ -72,8 +72,29 @@ main() { |
| // TODO(nweiz): Once a multipart/form-data parser in Dart exists, we should |
| // test that "pub lish" chooses the correct files to publish. |
| - // TODO(nweiz): Once issue 6813 is fixed, test that OAuth2 authentication |
| - // errors cause the client to try re-authenticating. |
| + test('credentials are invalid', () { |
| + var server = new ScheduledServer(); |
| + credentialsFile(server, 'access token').scheduleCreate(); |
| + var pub = startPubLish(server); |
| + |
| + server.handle('GET', '/packages/versions/new.json', (request, response) { |
| + response.statusCode = 401; |
| + response.headers.set('www-authenticate', 'Bearer error="invalid_token",' |
| + ' error_description="your token sucks"'); |
| + response.outputStream.writeString(JSON.stringify({ |
| + 'error': {'message': 'your token sucks'} |
| + })); |
| + return closeHttpResponse(request, response); |
| + }); |
| + |
| + expectLater(pub.nextErrLine(), equals('OAuth2 authorization failed (your ' |
|
Bob Nystrom
2012/12/05 17:39:46
The regular expect() function allows a literal in
nweiz
2012/12/05 19:33:55
That is supported. The "matcher" argument is passe
|
| + 'token sucks).')); |
| + expectLater(pub.nextLine(), equals('Pub needs your authorization to upload ' |
| + 'packages on your behalf.')); |
| + pub.kill(); |
| + |
| + run(); |
| + }); |
| test('upload form provides an error', () { |
| var server = new ScheduledServer(); |