Hi Birger,
You can mock out pretty much everything using the mock module in the
standard Python unittest library that Django already uses.
Depending on your code of course, but something like:
@mock.path('os.time.now')
def test_my_token(self, mock_now):
mock_now.return_value = datetime(3000, 12, 31)
# The rest of your test code goes here
Now your code should see the current time as being new years 3000.
I haven't tested this and there might be better ways to do that, but
that's how I would handle it. Hope that helps.
Kind regards,
Kasper Laudrup