Mock Expired Token for Integration Testing

Currently working through basic integration tests with apickli/cucmber and we are looking to mock an expired token for error handling purposes. Is there any way to do this successfully so that the tests do not fail once the expired token we are using is purged from the database (3 days)? After the 3 days - the tests default to giving an invalid token response versus expired.

Anyone figure out a way to do this dynamically for their tests or just mock it out?

Thanks.

0 1 512
1 REPLY 1

@Sarah Newport

How about generate a token with a 1 second (or even less) ttl ? I am assuming you are using a separate client app for your testing. You can include a custom attribute in that app with the ttl and then in the Generate OAuth token policy, set that custom attribute as the ttl. So in your test, it could expire quickly with which you could test the token expiry scenario.