mirror of
https://framagit.org/la-chariotte/la-chariotte.git
synced 2025-05-01 11:22:24 +02:00
fonction is_ongoing et tests
This commit is contained in:
parent
1a1ee02c51
commit
09e21f7e5b
2 changed files with 26 additions and 2 deletions
|
@ -1,3 +1,5 @@
|
|||
import datetime
|
||||
|
||||
from django.db import models
|
||||
from django.utils import timezone
|
||||
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
from django.test import TestCase
|
||||
import datetime
|
||||
|
||||
from django.test import TestCase
|
||||
from django.utils import timezone
|
||||
from .models import Grouped_order
|
||||
|
||||
|
||||
class GroupedOrderModelTests(TestCase):
|
||||
|
||||
def test_is_ongoing_with_ongoing_grouped_order(self):
|
||||
"""
|
||||
is_ongoing() returns True if the deadline is not crossed
|
||||
"""
|
||||
deadline = timezone.now() + datetime.timedelta(days=10)
|
||||
ongoing_gr_order = Grouped_order(deadline=deadline)
|
||||
self.assertIs(ongoing_gr_order.is_ongoing(), True)
|
||||
|
||||
def test_is_ongoing_with_old_grouped_order(self):
|
||||
"""
|
||||
is_ongoing() returns False if the deadline is crossed
|
||||
"""
|
||||
deadline = timezone.now() - datetime.timedelta(hours=1)
|
||||
ongoing_gr_order = Grouped_order(deadline=deadline)
|
||||
self.assertIs(ongoing_gr_order.is_ongoing(), False)
|
||||
|
||||
# Create your tests here.
|
||||
|
|
Loading…
Reference in a new issue