tests for scheduling module

Special _now function was added for ease of mocking datetime.datetime.now,
which was causing a headache.
fix casting error and make tests pass