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

Unified Diff: test/credentials_test.dart

Issue 1308163004: Async-ify. (Closed) Base URL: git@github.com:dart-lang/oauth2.git@master
Patch Set: Created 5 years, 4 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
« lib/src/authorization_code_grant.dart ('K') | « test/client_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/credentials_test.dart
diff --git a/test/credentials_test.dart b/test/credentials_test.dart
index 94b5445ea6ceebd8bde99e2e5aa6f164f6aa06f8..3bd44d301d1670a886aaafa10314131e083ea2c4 100644
--- a/test/credentials_test.dart
+++ b/test/credentials_test.dart
@@ -56,7 +56,7 @@ void main() {
throwsStateError);
});
- test("can refresh with a refresh token and a token endpoint", () {
+ test("can refresh with a refresh token and a token endpoint", () async {
var credentials = new oauth2.Credentials(
'access token', 'refresh token', tokenEndpoint, ['scope1', 'scope2']);
expect(credentials.canRefresh, true);
@@ -80,14 +80,13 @@ void main() {
});
- expect(credentials.refresh('identifier', 'secret', httpClient: httpClient)
- .then((credentials) {
- expect(credentials.accessToken, equals('new access token'));
- expect(credentials.refreshToken, equals('new refresh token'));
- }), completes);
+ credentials = await credentials.refresh('identifier', 'secret',
+ httpClient: httpClient);
+ expect(credentials.accessToken, equals('new access token'));
+ expect(credentials.refreshToken, equals('new refresh token'));
});
- test("uses the old refresh token if a new one isn't provided", () {
+ test("uses the old refresh token if a new one isn't provided", () async {
var credentials = new oauth2.Credentials(
'access token', 'refresh token', tokenEndpoint);
expect(credentials.canRefresh, true);
@@ -109,11 +108,10 @@ void main() {
});
- expect(credentials.refresh('identifier', 'secret', httpClient: httpClient)
- .then((credentials) {
- expect(credentials.accessToken, equals('new access token'));
- expect(credentials.refreshToken, equals('refresh token'));
- }), completes);
+ credentials = await credentials.refresh('identifier', 'secret',
+ httpClient: httpClient);
+ expect(credentials.accessToken, equals('new access token'));
+ expect(credentials.refreshToken, equals('refresh token'));
});
group("fromJson", () {
« lib/src/authorization_code_grant.dart ('K') | « test/client_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698