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", () { |