Unit test intervention forms

* adds unit test for new/edit intervention forms
* improves code base for generating new identifiers
This commit is contained in:
2023-08-24 11:47:40 +02:00
parent 21c7889551
commit a2b44a9c45
7 changed files with 153 additions and 29 deletions

View File

@@ -10,6 +10,7 @@ import shutil
from django.contrib import messages
from codelist.models import KonovaCode
from compensation.settings import COMPENSATION_IDENTIFIER_TEMPLATE, COMPENSATION_IDENTIFIER_LENGTH
from user.models import User, Team
from django.db import models, transaction
from django.db.models import QuerySet, Sum
@@ -296,6 +297,9 @@ class Compensation(AbstractCompensation, CEFMixin, CoherenceMixin, PikMixin):
objects = CompensationManager()
identifier_length = COMPENSATION_IDENTIFIER_LENGTH
identifier_template = COMPENSATION_IDENTIFIER_TEMPLATE
def __str__(self):
return "{}".format(self.identifier)

View File

@@ -9,6 +9,7 @@ import shutil
from django.urls import reverse
from compensation.settings import ECO_ACCOUNT_IDENTIFIER_TEMPLATE, ECO_ACCOUNT_IDENTIFIER_LENGTH
from konova.utils.message_templates import DEDUCTION_REMOVED, DOCUMENT_REMOVED_TEMPLATE
from django.core.exceptions import ValidationError
from django.core.validators import MinValueValidator
@@ -52,6 +53,9 @@ class EcoAccount(AbstractCompensation, ShareableObjectMixin, RecordableObjectMix
objects = EcoAccountManager()
identifier_length = ECO_ACCOUNT_IDENTIFIER_LENGTH
identifier_template = ECO_ACCOUNT_IDENTIFIER_TEMPLATE
def __str__(self):
return f"{self.identifier} ({self.title})"