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:
@@ -60,6 +60,29 @@ class User(AbstractUser):
|
||||
name=ETS_GROUP
|
||||
).exists()
|
||||
|
||||
def is_default_group_only(self) -> bool:
|
||||
""" Checks if the user is only part of the default group
|
||||
|
||||
Args:
|
||||
|
||||
Returns:
|
||||
bool
|
||||
"""
|
||||
return not self.in_group(ZB_GROUP) and not self.in_group(ETS_GROUP)
|
||||
|
||||
def in_group(self, group: str) -> bool:
|
||||
""" Checks if the user is part of a group
|
||||
|
||||
Args:
|
||||
group (str): The group's name
|
||||
|
||||
Returns:
|
||||
bool
|
||||
"""
|
||||
return self.groups.filter(
|
||||
name=group
|
||||
)
|
||||
|
||||
def send_mail_shared_access_removed(self, obj_identifier, obj_title, municipals_names):
|
||||
""" Sends a mail to the user in case of removed shared access
|
||||
|
||||
|
||||
Reference in New Issue
Block a user