Due to auto_now_add in django models sent_at is not working in pytest factory. Need to overrive sent_at for pytest factory
class ABC(models.Model):
x = models.ForeignKey(X, on_delete=models.CASCADE, related_name="xx")
y = models.ForeignKey(Y, on_delete=models.CASCADE, related_name="yy")
sent_at = models.DateTimeField(auto_now_add=True)
class ABCFactory(factory.django.DjangoModelFactory):
x = factory.SubFactory(XFactory)
y = factory.SubFactory(YFactory)
sent_at = timezone.now() - timezone.timedelta(seconds=40)