I wondering what is the best practice to write code for good testing. E.g.
class Visits(models.Model):
user = models.ForeignKey(User)
visited_at = models.DateTimeField()
def __unicode__(self):
return "{}-{}".format(self.user, self.visited_at)
And I need a function wich get me only visits for current user from last day. What should I do? Make view for this and test it? Or make model methods? What is the best to test?
Aucun commentaire:
Enregistrer un commentaire