equinor / eit-hub-experiments

A IoT hub for experimentation for Emerging IT.
MIT License
0 stars 3 forks source link

Mock-able time. #67

Closed gjersvik closed 4 years ago

gjersvik commented 4 years ago

I would like to unit test the device auth code. But time and unit testing do not mix.

Its very easy to create flaky tests that only work sometimes. (Literally in this case).

So i have create this small class that allows me to override the current time for my code so that test tokens expire in 60 sec without having tests that need over 60 sec to run.