Commit 841f62c4 authored by Myriam Begel's avatar Myriam Begel

Créer un test

parent c2832d90
import datetime
from django.db import models
from django.utils import timezone
class Publication(models.Model):
titre = models.CharField(max_length = 200)
......@@ -9,6 +11,9 @@ class Publication(models.Model):
def __str__(self):
return self.titre
def recent(self):
return ( >= - datetime.timedelta(months=6))
choices = (
('perso', 'Contact personel'),
import datetime
from django.utils import timezone
from django.test import TestCase
# Create your tests here.
from .models import Publication
class PublicationMethodTests(TestCase):
def test_recent_with_future_question(self):
recent() should return False for publication whose
date is in the future.
time = + datetime.timedelta(days=1)
future_publication = Publication(date=time)
self.assertIs(future_publication.recent(), False)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment