def testExpiredTokens(self):
    """Tests that expired tokens are rejected."""

    urn = rdf_client.ClientURN("C.%016X" % 0).Add("/fs/os/c")
    self.assertRaises(access_control.UnauthorizedAccess, aff4.FACTORY.Open, urn)

    with test_lib.FakeTime(100):
      # Token expires in 5 seconds.
      super_token = access_control.ACLToken(username="test", expiry=105)
      super_token.supervisor = True

      # This should work since token is a super token.
      aff4.FACTORY.Open(urn, mode="rw", token=super_token)

    # Change the time to 200
    with test_lib.FakeTime(200):

      # Should be expired now.
      self.assertRaises(access_control.ExpiryError, aff4.FACTORY.Open, urn,
                        token=super_token, mode="rw")
dataset/ETHPy150Open google/grr/grr/lib/aff4_objects/user_managers_test.py/FullAccessControlManagerIntegrationTest.testExpiredTokens/original