Merge "Refactoring: remove the duplicate method"

This commit is contained in:
Jenkins 2016-07-05 05:37:55 +00:00 committed by Gerrit Code Review
commit c8217ca2fb
3 changed files with 11 additions and 25 deletions

View File

@ -823,6 +823,17 @@ class TestCase(BaseTestCase):
self.assertTrue(abs(a - b).seconds <= delta, msg)
def assertTimestampEqual(self, expected, value):
# Compare two timestamps but ignore the microseconds part
# of the expected timestamp. Keystone does not track microseconds and
# is working to eliminate microseconds from it's datetimes used.
expected = timeutils.parse_isotime(expected).replace(microsecond=0)
value = timeutils.parse_isotime(value).replace(microsecond=0)
self.assertEqual(
expected,
value,
"%s != %s" % (expected, value))
def assertNotEmpty(self, l):
self.assertTrue(len(l))

View File

@ -245,17 +245,6 @@ class TokenAPITests(object):
return project
def assertTimestampEqual(self, expected, value):
# Compare two timestamps but ignore the microseconds part
# of the expected timestamp. Keystone does not track microseconds and
# is working to eliminate microseconds from it's datetimes used.
expected = timeutils.parse_isotime(expected).replace(microsecond=0)
value = timeutils.parse_isotime(value).replace(microsecond=0)
self.assertEqual(
expected,
value,
"%s != %s" % (expected, value))
def test_auth_with_token_as_different_user_fails(self):
# get the token for a user. This is self.user which is different from
# self.default_domain_user.

View File

@ -38,20 +38,6 @@ class OSRevokeTests(test_v3.RestfulTestCase, test_v3.JsonHomeTestMixin):
},
}
# TODO(davechen): This method is copied from `keystone.tests.unit.
# test_v3_auth.TokenAPITests`, move this method into utils.py to avoid
# the duplication?
def assertTimestampEqual(self, expected, value):
# Compare two timestamps but ignore the microseconds part
# of the expected timestamp. Keystone does not track microseconds and
# is working to eliminate microseconds from it's datetimes used.
expected = timeutils.parse_isotime(expected).replace(microsecond=0)
value = timeutils.parse_isotime(value).replace(microsecond=0)
self.assertEqual(
expected,
value,
"%s != %s" % (expected, value))
def test_get_empty_list(self):
resp = self.get('/OS-REVOKE/events')
self.assertEqual([], resp.json_body['events'])