Wednesday, January 25, 2017

Mocking date and time in LiveServerTestCase?

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

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6ed32c80-cd29-1511-17bc-7cc79f485cc5%40cafu.de.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment