new test for extern grant literature. removed args/kwargs from save

here too
This commit is contained in:
Benni Baermann 2021-10-06 16:15:58 +02:00
parent 0c863bce22
commit 4e4edc390c
2 changed files with 8 additions and 3 deletions

View file

@ -39,9 +39,9 @@ class Extern(Volunteer):
def save(self,*args,**kwargs):
# is there a way to call super().save() only once?
super().save(*args,**kwargs)
super().save()
self.service_id = type(self).__name__ + str(self.pk)
super().save(*args,**kwargs)
super().save()
class Meta:
abstract = True

View file

@ -3,7 +3,7 @@ from django.conf import settings
from django.contrib.auth.models import User
from datetime import date
from .models import HonoraryCertificate, Project, Account
from .models import HonoraryCertificate, Project, Account, Literature
class TestWithoutLogin(TestCase):
@ -85,6 +85,7 @@ class TestWithLogin(TestCase):
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")
@ -94,3 +95,7 @@ class TestWithLogin(TestCase):
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')
self.assertEqual(obj.service_id,'Literature1')