Wednesday, January 25, 2017

Re: Mocking date and time in LiveServerTestCase?

When I need to set the date to a known day for tests, I use forbiddenfruit (https://github.com/clarete/forbiddenfruit).

On Wed, 2017-01-25 at 20:46 +0100, Carsten Fuchs wrote:
Dear Django fellows,    I'm using LiveServerTestCase with Selenium. The application code run by   LiveServerTestCase's live server works well and a view's call to date.today()   returns the current date.    For the tests, however, it would be helpful if we could fix the time and date at   which the test is supposedly run, making date.today() and similar functions   return a predetermined value.    Can this be achieved?    Best regards,  Carsten    
--   Adam (adam@csh.rit.edu)    

No comments:

Post a Comment