|
|
@ -46,7 +46,10 @@ class TestWithLogin(TestCase): |
|
|
|
|
|
|
|
def test_project_of_year(self): |
|
|
|
''' test if the finance id is resettet ad start of year''' |
|
|
|
acc = Account.objects.create(code='1234', description='blabla') |
|
|
|
acc = Account.objects.create() |
|
|
|
acc.code='1234' |
|
|
|
acc.description='blabla' |
|
|
|
acc.save() |
|
|
|
startdate = date(2022,1,1) |
|
|
|
obj = Project.objects.create(account= acc, name='testproject', start=startdate) |
|
|
|
self.assertEqual(obj.project_of_year,1) |
|
|
@ -75,3 +78,19 @@ class TestWithLogin(TestCase): |
|
|
|
|
|
|
|
obj3 = Project.objects.create(account= acc, name='testproject2', start=startdate) |
|
|
|
self.assertEqual(obj3.finance_id,"1234003") |
|
|
|
|
|
|
|
def test_pid(self): |
|
|
|
''' test if the finance id is resettet ad start of year''' |
|
|
|
acc = Account.objects.create(code='1234', description='blabla') |
|
|
|
startdate = date(2022,1,1) |
|
|
|
obj = Project.objects.create(account= acc, name='testproject', start=startdate) |
|
|
|
self.assertEqual(obj.pid,"1234001") |
|
|
|
|
|
|
|
obj2 = Project.objects.create(account= acc, name='testproject2', start=startdate) |
|
|
|
self.assertEqual(obj2.pid,"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.pid,"1234004") |