'Test disabling trustee and using an unrevoked token.
This test simulates what happens when a token is generated *after* the
disable event. Technically this should not happen, but it\'s possible in
a multinode deployment with only a slight clock skew.'

def test_trust_get_token_fails_with_future_token_if_trustee_disabled(self):

    self.config_fixture.config(group='identity', caching=False)
    new_trust = self.create_trust(self.sample_data, self.trustor['name'])
    future_time = (timeutils.utcnow() + datetime.timedelta(seconds=5))
    with mock.patch.object(timeutils, 'utcnow', (lambda : future_time)):
        request_body = self.build_v2_token_request(self.trustee['name'], self.trustee['password'], new_trust)
    user = {'enabled': False}
    self.identity_api.driver.update_user(self.trustee['id'], user)
    self.assertRaises(exception.Unauthorized, self.controller.authenticate, self.make_request(), request_body)
