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

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

Issue 14694002: Fix a broken oauth2 test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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
« no previous file with comments | « pkg/oauth2/lib/src/client.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/oauth2/test/client_test.dart
diff --git a/pkg/oauth2/test/client_test.dart b/pkg/oauth2/test/client_test.dart
index bac05485457a3c55b4bed23877db0598bb093336..7a05e9905a7faedce8fb64a5513ac8c88df11abb 100644
--- a/pkg/oauth2/test/client_test.dart
+++ b/pkg/oauth2/test/client_test.dart
@@ -25,12 +25,6 @@ void createHttpClient() {
httpClient = new ExpectClient();
}
-void expectFutureThrows(future, predicate) {
- future.catchError(expectAsync1((error) {
- expect(predicate(error), isTrue);
- }));
-}
-
void main() {
group('with expired credentials', () {
setUp(createHttpClient);
@@ -42,8 +36,8 @@ void main() {
var client = new oauth2.Client('identifier', 'secret', credentials,
httpClient: httpClient);
- expectFutureThrows(client.get(requestUri),
- (e) => e is oauth2.ExpirationException);
+ expect(client.get(requestUri),
+ throwsA(new isInstanceOf<oauth2.ExpirationException>()));
});
test("that can be refreshed refreshes the credentials and sends the "
@@ -123,8 +117,7 @@ void main() {
var client = new oauth2.Client('identifier', 'secret', credentials,
httpClient: httpClient);
- expectFutureThrows(client.refreshCredentials(),
- (e) => e is StateError);
+ expect(client.refreshCredentials(), throwsA(isStateError));
Bob Nystrom 2013/04/30 21:56:54 You can use throwsStateError.
});
});
@@ -148,8 +141,8 @@ void main() {
headers: {'www-authenticate': authenticate}));
});
- expectFutureThrows(client.read(requestUri),
- (e) => e is oauth2.AuthorizationException);
+ expect(client.read(requestUri),
+ throwsA(new isInstanceOf<oauth2.AuthorizationException>()));
});
test('passes through a 401 response without www-authenticate', () {
« no previous file with comments | « pkg/oauth2/lib/src/client.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698