Refactoring

* adds simple getter methods for UserActionLogEntry
* replaces manual creation of UserActionLogEntry with new methods
This commit is contained in:
2021-11-16 13:15:15 +01:00
parent 7f43f197d5
commit 96caebcae1
12 changed files with 108 additions and 152 deletions

View File

@@ -20,7 +20,7 @@ from konova.management.commands.setup_data import GROUPS_DATA
from konova.models import Geometry
from konova.settings import DEFAULT_GROUP
from konova.utils.generators import generate_random_string
from user.models import UserActionLogEntry, UserAction
from user.models import UserActionLogEntry
class BaseTestCase(TestCase):
@@ -98,10 +98,7 @@ class BaseTestCase(TestCase):
"""
# Create dummy data
# Create log entry
action = UserActionLogEntry.objects.create(
user=cls.superuser,
action=UserAction.CREATED,
)
action = UserActionLogEntry.get_created_action(cls.superuser)
# Create legal data object (without M2M laws first)
legal_data = Legal.objects.create()
# Create responsible data object
@@ -131,10 +128,7 @@ class BaseTestCase(TestCase):
cls.intervention = cls.create_dummy_intervention()
# Create dummy data
# Create log entry
action = UserActionLogEntry.objects.create(
user=cls.superuser,
action=UserAction.CREATED,
)
action = UserActionLogEntry.get_created_action(cls.superuser)
geometry = Geometry.objects.create()
# Finally create main object, holding the other objects
compensation = Compensation.objects.create(
@@ -156,10 +150,7 @@ class BaseTestCase(TestCase):
"""
# Create dummy data
# Create log entry
action = UserActionLogEntry.objects.create(
user=cls.superuser,
action=UserAction.CREATED,
)
action = UserActionLogEntry.get_created_action(cls.superuser)
geometry = Geometry.objects.create()
# Create responsible data object
lega_data = Legal.objects.create()