test(core): Partial Functional Model test cases (Slash Commands) for TicketCommentBase
ref: #744 #726
This commit is contained in:
14
app/core/tests/functional/ticket_comment_base/conftest.py
Normal file
14
app/core/tests/functional/ticket_comment_base/conftest.py
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import pytest
|
||||||
|
|
||||||
|
from core.models.ticket_comment_base import TicketCommentBase
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture( scope = 'class')
|
||||||
|
def model(request):
|
||||||
|
|
||||||
|
request.cls.model = TicketCommentBase
|
||||||
|
|
||||||
|
yield request.cls.model
|
||||||
|
|
||||||
|
del request.cls.model
|
@ -0,0 +1,85 @@
|
|||||||
|
import pytest
|
||||||
|
|
||||||
|
from core.models.ticket.ticket import Ticket
|
||||||
|
from core.tests.functional.slash_commands.test_slash_command_related import SlashCommandsTicketCommentInheritedTestCases
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class TicketCommentBaseModelTestCases(
|
||||||
|
SlashCommandsTicketCommentInheritedTestCases
|
||||||
|
):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def ticket(self, request, django_db_blocker):
|
||||||
|
""" Ticket that requires body
|
||||||
|
|
||||||
|
when using this fixture, set the `description` then call ticket.save()
|
||||||
|
before use.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from core.models.ticket_comment_base import TicketBase
|
||||||
|
|
||||||
|
with django_db_blocker.unblock():
|
||||||
|
|
||||||
|
ticket = TicketBase()
|
||||||
|
|
||||||
|
ticket.organization = request.cls.organization
|
||||||
|
ticket.title = 'A ticket for slash commands'
|
||||||
|
ticket.opened_by = request.cls.ticket_user
|
||||||
|
|
||||||
|
ticket = TicketBase.objects.create(
|
||||||
|
organization = request.cls.organization,
|
||||||
|
title = 'A ticket for slash commands',
|
||||||
|
opened_by = request.cls.ticket_user,
|
||||||
|
)
|
||||||
|
|
||||||
|
yield ticket
|
||||||
|
|
||||||
|
with django_db_blocker.unblock():
|
||||||
|
|
||||||
|
ticket.delete()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def ticket_comment(self, request, django_db_blocker, ticket, model):
|
||||||
|
""" Ticket Comment that requires body
|
||||||
|
|
||||||
|
when using this fixture, set the `body` then call ticket_comment.save()
|
||||||
|
before use.
|
||||||
|
"""
|
||||||
|
|
||||||
|
with django_db_blocker.unblock():
|
||||||
|
|
||||||
|
ticket.title = 'slash command ticket with comment'
|
||||||
|
|
||||||
|
ticket.save()
|
||||||
|
|
||||||
|
ticket_comment = model()
|
||||||
|
|
||||||
|
ticket_comment.user = request.cls.entity_user
|
||||||
|
|
||||||
|
ticket_comment.ticket = ticket
|
||||||
|
|
||||||
|
ticket_comment.comment_type = 'comment'
|
||||||
|
|
||||||
|
yield ticket_comment
|
||||||
|
|
||||||
|
ticket_comment.delete()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class TicketCommentBaseModelInheritedTestCases(
|
||||||
|
TicketCommentBaseModelTestCases
|
||||||
|
):
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class TicketCommentBaseModelPyTest(
|
||||||
|
TicketCommentBaseModelTestCases
|
||||||
|
):
|
||||||
|
|
||||||
|
pass
|
@ -40,4 +40,6 @@ As with any other object within Centurion, the addition of a feature requires it
|
|||||||
|
|
||||||
- API Permissions `core.tests.functional.ticket_base.test_functional_ticket_base_permission.TicketBasePermissionsAPIInheritedCases`
|
- API Permissions `core.tests.functional.ticket_base.test_functional_ticket_base_permission.TicketBasePermissionsAPIInheritedCases`
|
||||||
|
|
||||||
|
- Model `app.core.tests.functional.ticket_base.test_functional_ticket_base_model.TicketBaseModelInheritedTestCases` _(if inheriting from `TicketBase`)_ Test cases for sub-models
|
||||||
|
|
||||||
The above listed test cases cover **all** tests for objects that are inherited from the base class. To complete the tests, you will need to add test cases for the differences your model introduces.
|
The above listed test cases cover **all** tests for objects that are inherited from the base class. To complete the tests, you will need to add test cases for the differences your model introduces.
|
||||||
|
Reference in New Issue
Block a user