chore(): test and validation improvements
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from typing import Any
|
||||
|
||||
from config.errors import ConflictError
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.db import transaction
|
||||
|
||||
@@ -91,13 +92,15 @@ def approver_group_create(
|
||||
) -> ApproverGroup:
|
||||
_validate_experimenter(experimenter)
|
||||
if ApproverGroup.objects.filter(experimenter=experimenter).exists():
|
||||
raise ValidationError(
|
||||
{
|
||||
"experimenter": (
|
||||
f"An approver group already exists for "
|
||||
f"experimenter '{experimenter.username}'."
|
||||
)
|
||||
}
|
||||
raise ConflictError(
|
||||
ValidationError(
|
||||
{
|
||||
"experimenter": (
|
||||
f"An approver group already exists for "
|
||||
f"experimenter '{experimenter.username}'."
|
||||
)
|
||||
}
|
||||
)
|
||||
)
|
||||
approvers: list[User] = []
|
||||
if approver_ids:
|
||||
|
||||
Reference in New Issue
Block a user