new test for finance_id added. failes as expected

This commit is contained in:
Benni Bärmann 2021-10-04 14:35:03 +02:00
parent 99a70229a1
commit 466ce45e13
1 changed files with 20 additions and 0 deletions

View File

@ -63,3 +63,23 @@ class TestWithLogin(TestCase):
obj3 = Project.objects.create(account= acc, name='testproject2', start=startdate) obj3 = Project.objects.create(account= acc, name='testproject2', start=startdate)
self.assertEqual(obj3.project_of_year,3) 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")