Fix the toJson/fromJson test.
DateTime has begun storing sub-millisecond times, which means that
storing and retrieving the milliseconds since the epoch no longer
produces an identical object. This rounds the test value to avoid this
failure.
R=kevmoo@google.com
Review URL: https://codereview.chromium.org//1531083002 .
diff --git a/pubspec.yaml b/pubspec.yaml
index 559fc7b..bdf86d6 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: oauth2
-version: 1.0.1
+version: 1.0.2-dev
author: Dart Team <misc@dartlang.org>
homepage: http://github.com/dart-lang/oauth2
description: >
diff --git a/test/credentials_test.dart b/test/credentials_test.dart
index f4d8886..cedea6b 100644
--- a/test/credentials_test.dart
+++ b/test/credentials_test.dart
@@ -231,7 +231,13 @@
new oauth2.Credentials.fromJson(JSON.encode(map));
test("should load the same credentials from toJson", () {
+ // Round the expiration down to milliseconds since epoch, since that's
+ // what the credentials file stores. Otherwise sub-millisecond time gets
+ // in the way.
var expiration = new DateTime.now().subtract(new Duration(hours: 1));
+ expiration = new DateTime.fromMillisecondsSinceEpoch(
+ expiration.millisecondsSinceEpoch);
+
var credentials = new oauth2.Credentials(
'access token',
refreshToken: 'refresh token',