test: correct tests from Meta.sub_model_type changes

ref: #732
This commit is contained in:
2025-04-26 08:40:29 +09:30
parent 51c238734a
commit 53abf219a3
4 changed files with 14 additions and 14 deletions

View File

@ -179,7 +179,7 @@ class TicketBase(
None: The ticket is for the Base class. Used to prevent creating a base ticket.
"""
ticket_type = str(self.Meta.verbose_name).lower().replace(' ', '_')
ticket_type = str(self.Meta.sub_model_type).lower().replace(' ', '_')
if ticket_type == 'ticket':
@ -200,7 +200,7 @@ class TicketBase(
if isinstance(model, TicketBase) or issubclass(model, TicketBase):
choices += [ (model._meta.verbose_name.lower().replace(' ', '_'), model._meta.verbose_name) ]
choices += [ (model._meta.sub_model_type, model._meta.verbose_name) ]
return choices
@ -210,7 +210,7 @@ class TicketBase(
blank = True,
choices = get_ticket_type_choices,
# default = get_ticket_type_default,
default = Meta.verbose_name.lower().replace(' ', '_'),
default = Meta.sub_model_type,
help_text = 'Ticket Type. (derived from ticket model)',
max_length = 30,
null = False,
@ -745,18 +745,18 @@ class TicketBase(
model = self.get_related_model()
if len(self._meta.parents) == 0 and model is None:
# if len(self._meta.parents) == 0 and model is None:
return {
'pk': self.id
}
# return {
# 'pk': self.id
# }
if model is None:
model = self
kwargs = {
'ticket_model': str(model._meta.verbose_name).lower().replace(' ', '_'),
'ticket_model': self.ticket_type,
}
if model.pk:
@ -781,9 +781,9 @@ class TicketBase(
related_model = self
if self.ticket_type != str(related_model._meta.verbose_name).lower().replace(' ', '_'):
if self.ticket_type != str(related_model._meta.sub_model_type).lower().replace(' ', '_'):
self.ticket_type = str(related_model._meta.verbose_name).lower().replace(' ', '_')
self.ticket_type = str(related_model._meta.sub_model_type).lower().replace(' ', '_')
if self.date_solved is None and self.is_solved:

View File

@ -98,7 +98,7 @@ class TicketCommentBase(
@property
def get_comment_type(self):
comment_type = str(self.Meta.verbose_name).lower().replace(
comment_type = str(self.Meta.sub_model_type).lower().replace(
' ', '_'
)

View File

@ -67,11 +67,11 @@ class TicketBasePermissionsAPIInheritedCases(
def inherited_var_setup(self, request):
request.cls.url_kwargs.update({
'ticket_model': self.model._meta.model_name
'ticket_model': self.model._meta.sub_model_type
})
request.cls.url_view_kwargs.update({
'ticket_model': self.model._meta.model_name
'ticket_model': self.model._meta.sub_model_type
})

View File

@ -68,7 +68,7 @@ class APITestCases(
if request.cls.model._meta.model_name != 'ticketbase':
request.cls.url_view_kwargs.update({
'ticket_model': str(request.cls.model._meta.verbose_name).lower().replace(' ', '_'),
'ticket_model': str(request.cls.model._meta.sub_model_type),
})
yield