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

Unified Diff: test/authorization_code_grant_test.dart

Issue 1311323002: Modernize the style. (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
Index: test/authorization_code_grant_test.dart
diff --git a/test/authorization_code_grant_test.dart b/test/authorization_code_grant_test.dart
index 24ff59c1624086a1bf0196225dfdc91ed5c06236..deaad5c14258c0b148d4e0b4b24f1abc75649a5e 100644
--- a/test/authorization_code_grant_test.dart
+++ b/test/authorization_code_grant_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-library authorization_code_grant_test;
-
import 'dart:async';
import 'dart:convert';
@@ -15,24 +13,20 @@ import 'utils.dart';
final redirectUrl = Uri.parse('http://example.com/redirect');
-ExpectClient client;
-
-oauth2.AuthorizationCodeGrant grant;
-
-void createGrant() {
- client = new ExpectClient();
- grant = new oauth2.AuthorizationCodeGrant(
- 'identifier',
- 'secret',
- Uri.parse('https://example.com/authorization'),
- Uri.parse('https://example.com/token'),
- httpClient: client);
-}
-
void main() {
- group('.getAuthorizationUrl', () {
- setUp(createGrant);
+ var client;
+ var grant;
+ setUp(() {
+ client = new ExpectClient();
+ grant = new oauth2.AuthorizationCodeGrant(
+ 'identifier',
+ 'secret',
+ Uri.parse('https://example.com/authorization'),
+ Uri.parse('https://example.com/token'),
+ httpClient: client);
+ });
+ group('.getAuthorizationUrl', () {
test('builds the correct URL', () {
expect(grant.getAuthorizationUrl(redirectUrl).toString(),
equals('https://example.com/authorization'
@@ -87,8 +81,6 @@ void main() {
});
group('.handleAuthorizationResponse', () {
- setUp(createGrant);
-
test("can't be called before .getAuthorizationUrl", () {
expect(grant.handleAuthorizationResponse({}), throwsStateError);
});
@@ -153,8 +145,6 @@ void main() {
});
group('.handleAuthorizationCode', () {
- setUp(createGrant);
-
test("can't be called before .getAuthorizationUrl", () {
expect(grant.handleAuthorizationCode('auth code'), throwsStateError);
});

Powered by Google App Engine
This is Rietveld 408576698