On Fri, Mar 13, 2015 at 5:32 AM, Collin Anderson <cmawebs...@gmail.com> wrote: > Hi, > > You could try using freezegun to run the test as if it were a certain time > of day. > https://pypi.python.org/pypi/freezegun
Hi Collin, thanks for the response. After spent some time, finally I managed to get the testing. I put my code snippets here https://gist.github.com/za/2a217c47582737f88259 > Or, you could say something like: > if 9 <= datetime.datetime.now().hour < 17: > self.assertContains(response, "It's working time!") > else: > self.assertContains(response, "Happy holiday!") > > That way it will at least not fail (most of the time :). Yes, but my mentor said it's not best practice in testing because we want to test all the condition whenever we execute the test code. -- 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+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAE7Ck-TX83e9Qt_Xm35rqUzWNBP%2Be_QtE5%3Dicz7_Ydx1-spQuA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.