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

Unified Diff: pkg/oauth2/test/credentials_test.dart

Issue 187843006: pkg/oauth2 bringing tests into 2014 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: pkg/oauth2/test/credentials_test.dart
diff --git a/pkg/oauth2/test/credentials_test.dart b/pkg/oauth2/test/credentials_test.dart
index f3e303b9af66ab0f657b585ff56d2119411c9c53..80b2dd4fe9a431aea42cc1082bcdc08026d20545 100644
--- a/pkg/oauth2/test/credentials_test.dart
+++ b/pkg/oauth2/test/credentials_test.dart
@@ -15,9 +15,9 @@ import 'utils.dart';
final Uri tokenEndpoint = Uri.parse('http://example.com/token');
-ExpectClient httpClient;
-
void main() {
+ ExpectClient httpClient;
nweiz 2014/03/05 22:38:08 If you're going to move this into [main], get rid
+
setUp(() => httpClient = new ExpectClient());
test('is not expired if no expiration exists', () {
@@ -43,19 +43,17 @@ void main() {
var credentials = new oauth2.Credentials(
'access token', null, tokenEndpoint);
expect(credentials.canRefresh, false);
- credentials.refresh('identifier', 'secret', httpClient: httpClient)
- .catchError(expectAsync1((error) {
- expect(error is StateError, isTrue);
- }));
+
+ expect(credentials.refresh('identifier', 'secret', httpClient: httpClient),
+ throwsStateError);
});
test("can't refresh without a token endpoint", () {
var credentials = new oauth2.Credentials('access token', 'refresh token');
expect(credentials.canRefresh, false);
- credentials.refresh('identifier', 'secret', httpClient: httpClient)
- .catchError(expectAsync1((error) {
- expect(error is StateError, isTrue);
- }));
+
+ expect(credentials.refresh('identifier', 'secret', httpClient: httpClient),
+ throwsStateError);
});
test("can refresh with a refresh token and a token endpoint", () {

Powered by Google App Engine
This is Rietveld 408576698