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

Side by Side Diff: test/credentials_test.dart

Issue 1311323002: Modernize the style. (Closed) Base URL: git@github.com:dart-lang/oauth2.git@master
Patch Set: Created 5 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library credentials_test;
6
7 import 'dart:async'; 5 import 'dart:async';
8 import 'dart:convert'; 6 import 'dart:convert';
9 7
10 import 'package:http/http.dart' as http; 8 import 'package:http/http.dart' as http;
11 import 'package:oauth2/oauth2.dart' as oauth2; 9 import 'package:oauth2/oauth2.dart' as oauth2;
12 import 'package:test/test.dart'; 10 import 'package:test/test.dart';
13 11
14 import 'utils.dart'; 12 import 'utils.dart';
15 13
16 final Uri tokenEndpoint = Uri.parse('http://example.com/token'); 14 final Uri tokenEndpoint = Uri.parse('http://example.com/token');
17 15
18 ExpectClient httpClient;
19
20 void main() { 16 void main() {
17 var httpClient;
21 setUp(() => httpClient = new ExpectClient()); 18 setUp(() => httpClient = new ExpectClient());
22 19
23 test('is not expired if no expiration exists', () { 20 test('is not expired if no expiration exists', () {
24 var credentials = new oauth2.Credentials('access token'); 21 var credentials = new oauth2.Credentials('access token');
25 expect(credentials.isExpired, isFalse); 22 expect(credentials.isExpired, isFalse);
26 }); 23 });
27 24
28 test('is not expired if the expiration is in the future', () { 25 test('is not expired if the expiration is in the future', () {
29 var expiration = new DateTime.now().add(new Duration(hours: 1)); 26 var expiration = new DateTime.now().add(new Duration(hours: 1));
30 var credentials = new oauth2.Credentials( 27 var credentials = new oauth2.Credentials(
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 expect(() => fromMap({"accessToken": "foo", "scopes": 12}), 162 expect(() => fromMap({"accessToken": "foo", "scopes": 12}),
166 throwsFormatException); 163 throwsFormatException);
167 }); 164 });
168 165
169 test("should throw a FormatException if expiration is not an int", () { 166 test("should throw a FormatException if expiration is not an int", () {
170 expect(() => fromMap({"accessToken": "foo", "expiration": "12"}), 167 expect(() => fromMap({"accessToken": "foo", "expiration": "12"}),
171 throwsFormatException); 168 throwsFormatException);
172 }); 169 });
173 }); 170 });
174 } 171 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698