test(settings): API Field Checks for App Settings History
ref: #605 #642
This commit is contained in:
@ -0,0 +1,43 @@
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.test import TestCase
|
||||
|
||||
from core.tests.abstract.test_unit_model_history_api_v2 import PrimaryModelHistoryAPI
|
||||
|
||||
from settings.models.app_settings_history import AppSettings, AppSettingsHistory
|
||||
|
||||
|
||||
|
||||
class ModelHistoryAPI(
|
||||
PrimaryModelHistoryAPI,
|
||||
TestCase,
|
||||
):
|
||||
|
||||
audit_model = AppSettings
|
||||
|
||||
model = AppSettingsHistory
|
||||
|
||||
@classmethod
|
||||
def setUpTestData(self):
|
||||
|
||||
super().setUpTestData()
|
||||
|
||||
self.audit_object = self.audit_model.objects.get(
|
||||
owner_organization = None,
|
||||
)
|
||||
|
||||
|
||||
self.history_entry = self.model.objects.create(
|
||||
organization = self.organization,
|
||||
action = self.model.Actions.ADD,
|
||||
user = self.view_user,
|
||||
before = {},
|
||||
after = {},
|
||||
content_type = ContentType.objects.get(
|
||||
app_label = self.audit_object._meta.app_label,
|
||||
model = self.audit_object._meta.model_name,
|
||||
),
|
||||
model = self.audit_object,
|
||||
)
|
||||
|
||||
|
||||
self.make_request()
|
@ -2,6 +2,8 @@ from drf_spectacular.utils import extend_schema, extend_schema_view, OpenApiResp
|
||||
|
||||
from api.viewsets.common import ModelRetrieveUpdateViewSet
|
||||
|
||||
# This import only exists so that the migrations can be created
|
||||
from settings.models.app_settings_history import AppSettingsHistory # pylint: disable=W0611:unused-import
|
||||
from settings.serializers.app_settings import (
|
||||
AppSettings,
|
||||
AppSettingsModelSerializer,
|
||||
|
Reference in New Issue
Block a user