projects_of_year test expanded, fails now (as expected)
This commit is contained in:
parent
86d08db262
commit
bef1f6d5ae
|
@ -98,6 +98,12 @@ class Project(Volunteer):
|
|||
# self.finance_id = "1234000"
|
||||
year = self.start.year
|
||||
print(f"startyear: {year}")
|
||||
projects = Project.objects.filter(start__year=year)
|
||||
print(projects)
|
||||
if not projects:
|
||||
self.project_of_year = 1
|
||||
else:
|
||||
pass
|
||||
else:
|
||||
print(f"project_of_year is {self.project_of_year}")
|
||||
super().save(*args,**kwargs)
|
||||
|
|
|
@ -54,3 +54,6 @@ class TestWithLogin(TestCase):
|
|||
#obj.save()
|
||||
print(f'pid: {obj.project_of_year}')
|
||||
self.assertEqual(obj.project_of_year,1)
|
||||
|
||||
obj2 = Project.objects.create(account= acc, name='testproject2', start=startdate)
|
||||
self.assertEqual(obj.project_of_year,2)
|
||||
|
|
Loading…
Reference in New Issue