Unit test user app
* adds unit test for User model and forms * refactors functions from user_checks.py into User class and drops user_checks.py
This commit is contained in:
@@ -12,7 +12,6 @@ from django.utils.translation import gettext_lazy as _
|
||||
from intervention.inputs import TextToClipboardInput
|
||||
from konova.forms.modals import BaseModalForm
|
||||
from konova.utils.message_templates import ENTRY_REMOVE_MISSING_PERMISSION
|
||||
from konova.utils.user_checks import is_default_group_only
|
||||
from user.models import Team, User
|
||||
|
||||
|
||||
@@ -80,7 +79,7 @@ class ShareModalForm(BaseModalForm):
|
||||
teams = self.cleaned_data.get("teams", Team.objects.none())
|
||||
|
||||
_is_valid = True
|
||||
if is_default_group_only(self.user):
|
||||
if self.user.is_default_group_only():
|
||||
shared_users = self.instance.shared_users
|
||||
shared_teams = self.instance.shared_teams
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ from konova.settings import DEFAULT_GROUP, ZB_GROUP, ETS_GROUP
|
||||
from konova.sub_settings.context_settings import TAB_TITLE_IDENTIFIER
|
||||
from konova.utils.message_templates import DATA_CHECKED_PREVIOUSLY_TEMPLATE, RECORDED_BLOCKS_EDIT, \
|
||||
CHECK_STATE_RESET, FORM_INVALID, IDENTIFIER_REPLACED, DO_NOT_FORGET_TO_SHARE, GEOMETRY_SIMPLIFIED
|
||||
from konova.utils.user_checks import in_group
|
||||
|
||||
|
||||
@login_required
|
||||
@@ -186,9 +185,9 @@ def detail_view(request: HttpRequest, id: str):
|
||||
"compensations": compensations,
|
||||
"has_access": is_data_shared,
|
||||
"geom_form": geom_form,
|
||||
"is_default_member": in_group(_user, DEFAULT_GROUP),
|
||||
"is_zb_member": in_group(_user, ZB_GROUP),
|
||||
"is_ets_member": in_group(_user, ETS_GROUP),
|
||||
"is_default_member": _user.in_group(DEFAULT_GROUP),
|
||||
"is_zb_member": _user.in_group(ZB_GROUP),
|
||||
"is_ets_member": _user.in_group(ETS_GROUP),
|
||||
"LANIS_LINK": intervention.get_LANIS_link(),
|
||||
"has_payment_without_document": has_payment_without_document,
|
||||
TAB_TITLE_IDENTIFIER: f"{intervention.identifier} - {intervention.title}",
|
||||
|
||||
Reference in New Issue
Block a user