Browse Source

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

here too
master
Benni Baermann 3 years ago
parent
commit
4e4edc390c
2 changed files with 8 additions and 3 deletions
  1. +2
    -2
      input/models.py
  2. +6
    -1
      input/tests.py

+ 2
- 2
input/models.py 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

+ 6
- 1
input/tests.py 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')

Loading…
Cancel
Save