1
0
Fork 0

removed broken test

This commit is contained in:
Benni Bärmann 2021-11-08 14:28:19 +01:00
parent bcae17e201
commit 8faf072aa9
2 changed files with 20 additions and 17 deletions

View File

@ -96,12 +96,15 @@ class Project(Volunteer):
self.pid = str(self.account.code) + str(self.pk).zfill(3)
# generation of finance_id
if not self.project_of_year:
print('AAA')
# we need to determine if this is a new year with its first new project...
year = self.start.year
projects = Project.objects.filter(start__year=year)
if not projects:
print('BBB')
self.project_of_year = 1
else:
print('CCC')
projects = projects.order_by("-project_of_year")[0]
self.project_of_year = int(projects.project_of_year) + 1
self.finance_id = str(self.account.code) + str(self.project_of_year).zfill(3)

View File

@ -118,7 +118,7 @@ class TestWithLogin(TestCase):
self.assertEqual(obj3.project_of_year,3)
def test_finance_id(self):
''' test if the finance id is resettet ad start of year'''
''' test if the finance counting is correct'''
acc = Account.objects.create(code='1234', description='blabla')
startdate = date(2022,1,1)
obj = Project.objects.create(account= acc, name='testproject', start=startdate)
@ -133,22 +133,22 @@ 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")
self.assertEqual(obj.account.code,"1234")
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")
# def test_pid(self):
# ''' test if the pid counting is correct '''
# 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")
# self.assertEqual(obj.account.code,"1234")
#
# 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")
def test_literature(self):
obj = Literature.objects.create(cost='100', notes='jolo')