mirror of
https://framagit.org/la-chariotte/la-chariotte.git
synced 2025-05-01 11:22:24 +02:00
24 lines
No EOL
816 B
Python
24 lines
No EOL
816 B
Python
import datetime
|
|
|
|
from django.utils import timezone
|
|
from la_chariotte.order.models import Grouped_order
|
|
|
|
|
|
|
|
class TestGroupedOrdersModel():
|
|
"""Tests for Grouped orders model"""
|
|
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)
|
|
assert 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)
|
|
assert not ongoing_gr_order.is_ongoing() |