'Assert that two tokens are equal.
Compare two tokens except for their ids. This also truncates
the time in the comparison.'

def assertEqualTokens(self, a, b):

    def normalize(token):
        del token['token']['expires_at']
        del token['token']['issued_at']
        return token
    a_expires_at = self.assertValidISO8601ExtendedFormatDatetime(a['token']['expires_at'])
    b_expires_at = self.assertValidISO8601ExtendedFormatDatetime(b['token']['expires_at'])
    self.assertCloseEnoughForGovernmentWork(a_expires_at, b_expires_at)
    a_issued_at = self.assertValidISO8601ExtendedFormatDatetime(a['token']['issued_at'])
    b_issued_at = self.assertValidISO8601ExtendedFormatDatetime(b['token']['issued_at'])
    self.assertCloseEnoughForGovernmentWork(a_issued_at, b_issued_at)
    return self.assertDictEqual(normalize(a), normalize(b))
