def test_can_post_in_forum_time(self):
If you have no sounds, you can"t post within 5 minutes of the last one
created = datetime.datetime(2019, 2, 3, 10, 50, 00)
post = Post.objects.create(thread=self.thread, body="", author=self.user, moderation_state="OK")
post.created = created
post.save()
with freezegun.freeze_time("2019-02-03 10:52:30"):
can_post, reason = self.user.profile.can_post_in_forum()
After Change
def test_can_post_in_forum_time(self):
If you have no sounds, you can"t post within 5 minutes of the last one
created = parse_date("2019-02-03 10:50:00")
post = Post.objects.create(thread=self.thread, body="", author=self.user, moderation_state="OK")
post.created = created
post.save()
with freezegun.freeze_time("2019-02-03 10:52:30"):
can_post, reason = self.user.profile.can_post_in_forum()