From 466ce45e136d4a86e128750c260303f6bce12f60 Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Mon, 4 Oct 2021 14:35:03 +0200 Subject: [PATCH] new test for finance_id added. failes as expected --- input/tests.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/input/tests.py b/input/tests.py index 8b1d60b..17fd798 100644 --- a/input/tests.py +++ b/input/tests.py @@ -63,3 +63,23 @@ class TestWithLogin(TestCase): obj3 = Project.objects.create(account= acc, name='testproject2', start=startdate) self.assertEqual(obj3.project_of_year,3) + + def test_finance_id(self): + ''' test if the finance id is resettet ad start of year''' + # self.client.login(username='vladimir', password='reiherzehe') + acc = Account.objects.create(code='1234', description='blabla') + #acc.save() + startdate = date(2022,1,1) + obj = Project.objects.create(account= acc, name='testproject', start=startdate) + #obj.save() + # print(f'p_of_year: {obj.project_of_year}') + self.assertEqual(obj.finance_id,"1234001") + + obj2 = Project.objects.create(account= acc, name='testproject2', start=startdate) + self.assertEqual(obj2.finance_id,"1234002") + + olddate = date(2021,12,31) + obj4 = Project.objects.create(account= acc, name='testproject2', start=olddate) + + obj3 = Project.objects.create(account= acc, name='testproject2', start=startdate) + self.assertEqual(obj3.finance_id,"1234003")