Commit 2c9471cb authored by MOREAU Ulysse's avatar MOREAU Ulysse
Browse files

correct tests

parent b75f8877
...@@ -4,7 +4,7 @@ from unittest.mock import Mock ...@@ -4,7 +4,7 @@ from unittest.mock import Mock
from unittest.mock import patch from unittest.mock import patch
from django.templatetags.static import static from django.templatetags.static import static
from django.utils import timezone from django.utils import timezone as django_timezone
from . import CategoryTestCase from . import CategoryTestCase
from . import OrderItemTestCase from . import OrderItemTestCase
...@@ -744,7 +744,7 @@ class OrderTest(PaymentTestCase, OrderItemTestCase): ...@@ -744,7 +744,7 @@ class OrderTest(PaymentTestCase, OrderItemTestCase):
hidden_item.refresh_from_db() hidden_item.refresh_from_db()
# YES, this would have failed anywhere near the year 1970 # YES, this would have failed anywhere near the year 1970
ood_item.end_date = datetime.datetime(timezone.now().year - 2, 1, 1, 0, 0) ood_item.end_date = datetime.datetime(django_timezone.now().year - 2, 1, 1, 0, 0)
ood_item.save() ood_item.save()
ood_item.refresh_from_db() ood_item.refresh_from_db()
...@@ -773,7 +773,7 @@ class OrderTest(PaymentTestCase, OrderItemTestCase): ...@@ -773,7 +773,7 @@ class OrderTest(PaymentTestCase, OrderItemTestCase):
self.assertFalse(pack_with_illegal_children.contains_illegal_items) self.assertFalse(pack_with_illegal_children.contains_illegal_items)
self.assertFalse(legal_item.contains_illegal_items) self.assertFalse(legal_item.contains_illegal_items)
items_in_pack = [oi.item for oi in self.order.items.all()] items_in_order = [oi.item for oi in self.order.items.all()]
deleted_count = self.order.clean_illegal_items() deleted_count = self.order.clean_illegal_items()
self.assertEqual(deleted_count, 0) self.assertEqual(deleted_count, 0)
...@@ -782,10 +782,10 @@ class OrderTest(PaymentTestCase, OrderItemTestCase): ...@@ -782,10 +782,10 @@ class OrderTest(PaymentTestCase, OrderItemTestCase):
items_in_order = [oi.item for oi in self.order.items.all()] items_in_order = [oi.item for oi in self.order.items.all()]
self.assertTrue(hidden_item in items_in_pack) self.assertTrue(hidden_item in items_in_order)
self.assertTrue(ood_item in items_in_pack) self.assertTrue(ood_item in items_in_order)
self.assertTrue(pack_with_illegal_children in items_in_pack) self.assertTrue(pack_with_illegal_children in items_in_order)
self.assertTrue(legal_item in items_in_pack) self.assertTrue(legal_item in items_in_order)
def test_delete_illegal_items_on_unordered_order(self) -> None: def test_delete_illegal_items_on_unordered_order(self) -> None:
hidden_item = self.create_item() hidden_item = self.create_item()
...@@ -807,7 +807,7 @@ class OrderTest(PaymentTestCase, OrderItemTestCase): ...@@ -807,7 +807,7 @@ class OrderTest(PaymentTestCase, OrderItemTestCase):
hidden_item.refresh_from_db() hidden_item.refresh_from_db()
# YES, this would have failed anywhere near the year 1970 # YES, this would have failed anywhere near the year 1970
ood_item.end_date = datetime.datetime(timezone.now().year - 2, 1, 1, 0, 0) ood_item.end_date = datetime.datetime(django_timezone.now().year - 2, 1, 1, 0, 0)
ood_item.save() ood_item.save()
ood_item.refresh_from_db() ood_item.refresh_from_db()
......
Supports Markdown
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