From 6a352d642b02e036f43ecaa8ad933481868e051c Mon Sep 17 00:00:00 2001 From: Skia Date: Fri, 23 Apr 2021 11:56:33 +0200 Subject: [PATCH] accounting: fix tests with a computed date instead of hard-coded one --- accounting/tests.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/accounting/tests.py b/accounting/tests.py index f424d8e8..f1d7e855 100644 --- a/accounting/tests.py +++ b/accounting/tests.py @@ -25,7 +25,7 @@ from django.test import TestCase from django.urls import reverse from django.core.management import call_command -from datetime import date +from datetime import date, timedelta from core.models import User from accounting.models import ( @@ -110,6 +110,9 @@ class JournalTest(TestCase): class OperationTest(TestCase): def setUp(self): call_command("populate") + self.tomorrow_formatted = (date.today() + timedelta(days=1)).strftime( + "%d/%m/%Y" + ) self.journal = GeneralJournal.objects.filter(id=1).first() self.skia = User.objects.filter(username="skia").first() at = AccountingType( @@ -158,7 +161,7 @@ class OperationTest(TestCase): "target_type": "OTHER", "target_id": "", "target_label": "Le fantome de la nuit", - "date": "04/12/2020", + "date": self.tomorrow_formatted, "mode": "CASH", "cheque_number": "", "invoice": "", @@ -191,7 +194,7 @@ class OperationTest(TestCase): "target_type": "OTHER", "target_id": "", "target_label": "Le fantome de la nuit", - "date": "04/12/2020", + "date": self.tomorrow_formatted, "mode": "CASH", "cheque_number": "", "invoice": "", @@ -218,7 +221,7 @@ class OperationTest(TestCase): "target_type": "OTHER", "target_id": "", "target_label": "Le fantome du jour", - "date": "04/12/2020", + "date": self.tomorrow_formatted, "mode": "CASH", "cheque_number": "", "invoice": "", @@ -245,7 +248,7 @@ class OperationTest(TestCase): "target_type": "OTHER", "target_id": "", "target_label": "Le fantome de l'aurore", - "date": "04/12/2020", + "date": self.tomorrow_formatted, "mode": "CASH", "cheque_number": "", "invoice": "",