From 4e4edc390c89791e8b668aa849b1cea0d8645306 Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Wed, 6 Oct 2021 16:15:58 +0200 Subject: [PATCH] new test for extern grant literature. removed args/kwargs from save here too --- input/models.py | 4 ++-- input/tests.py | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/input/models.py b/input/models.py index 6f42c34..b798ef8 100644 --- a/input/models.py +++ b/input/models.py @@ -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 diff --git a/input/tests.py b/input/tests.py index 86a2e1e..7f8d9bc 100644 --- a/input/tests.py +++ b/input/tests.py @@ -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')