'Test disabling trustee and using an unrevoked token.
This test simulates what happens when a Fernet 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):

    new_trust = self.create_trust(self.sample_data, self.trustor['name'])
    epoch = datetime.datetime.utcfromtimestamp(0)
    future_time = ((timeutils.utcnow() - epoch).total_seconds() + 5)
    with mock.patch.object(time, 'time', (lambda : future_time)):
        request_body = self.build_v2_token_request(self.trustee['name'], self.trustee['password'], new_trust)
    self.disable_user(self.trustee)
    self.assertRaises(exception.Unauthorized, self.controller.authenticate, self.make_request(), request_body)
