Skip to content

Commit

Permalink
test(Core): Ticket linked items API V2 Serializer returned checks
Browse files Browse the repository at this point in the history
ref: #15 #392 closes #393
  • Loading branch information
jon-nfc committed Nov 25, 2024
1 parent 57a9ad8 commit 04a090c
Showing 1 changed file with 162 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,19 @@
APIPermissionDelete,
APIPermissionView
)
from api.tests.abstract.api_serializer_viewset import (
SerializerAdd,
SerializerDelete,
SerializerView
)

from core.models.ticket.ticket_linked_items import Ticket, TicketLinkedItem

from settings.models.user_settings import UserSettings



class BaseTicketLinkedItemPermissionsAPI(
APIPermissionAdd,
APIPermissionDelete,
APIPermissionView,
):
class ViewSetBase:
""" Test Cases common to ALL ticket types """

model = TicketLinkedItem
Expand Down Expand Up @@ -232,8 +233,37 @@ def setUpTestData(self):



class BaseItemTicketPermissionsAPI(
BaseTicketLinkedItemPermissionsAPI,







class ViewSetBasePermissionsAPI(
ViewSetBase,
APIPermissionAdd,
APIPermissionDelete,
APIPermissionView,
):

pass



class ViewSetBaseSerializer(
ViewSetBase,
SerializerAdd,
SerializerDelete,
SerializerView,
):

pass



class BaseItemTicket(
# ViewSetBasePermissionsAPI,
):
""" Test Cases common to ALL ticket types """

Expand Down Expand Up @@ -266,6 +296,13 @@ def setUpTestData(self):



class BaseItemTicketPermissionsAPI(
BaseItemTicket,
ViewSetBasePermissionsAPI,
):



def test_add_has_permission(self):
""" Check correct permission for add
Expand All @@ -289,11 +326,16 @@ def test_add_has_permission(self):




class ItemClusterTicketPermissionsAPI(
BaseItemTicketPermissionsAPI,
TestCase
class BaseItemTicketSerializer(
BaseItemTicket,
ViewSetBaseSerializer,
):

pass



class ItemCluster:
""" Test Cases common to ALL ticket types """


Expand Down Expand Up @@ -325,10 +367,27 @@ def setUpTestData(self):



class ItemConfigGroupsTicketPermissionsAPI(
class ItemClusterTicketPermissionsAPI(
ItemCluster,
BaseItemTicketPermissionsAPI,
TestCase
):

pass



class ItemClusterTicketSerializer(
ItemCluster,
BaseItemTicketSerializer,
TestCase
):

pass



class ItemConfigGroups:
""" Test Cases common to ALL ticket types """


Expand Down Expand Up @@ -360,10 +419,27 @@ def setUpTestData(self):



class ItemDeviceTicketPermissionsAPI(
class ItemConfigGroupsTicketPermissionsAPI(
ItemConfigGroups,
BaseItemTicketPermissionsAPI,
TestCase
):

pass



class ItemConfigGroupsTicketSerializer(
ItemConfigGroups,
BaseItemTicketSerializer,
TestCase
):

pass



class ItemDeviceTicket:
""" Test Cases common to ALL ticket types """


Expand Down Expand Up @@ -393,10 +469,28 @@ def setUpTestData(self):
super().setUpTestData()


class ItemOperatingSystemTicketPermissionsAPI(

class ItemDeviceTicketPermissionsAPI(
ItemDeviceTicket,
BaseItemTicketPermissionsAPI,
TestCase
):

pass



class ItemDeviceTicketSerializer(
ItemDeviceTicket,
BaseItemTicketSerializer,
TestCase
):

pass



class ItemOperatingSystem:
""" Test Cases common to ALL ticket types """


Expand Down Expand Up @@ -428,10 +522,27 @@ def setUpTestData(self):



class ItemServiceTicketPermissionsAPI(
class ItemOperatingSystemTicketPermissionsAPI(
ItemOperatingSystem,
BaseItemTicketPermissionsAPI,
TestCase
):

pass



class ItemOperatingSystemSerializer(
ItemOperatingSystem,
BaseItemTicketSerializer,
TestCase
):

pass



class ItemService:
""" Test Cases common to ALL ticket types """


Expand Down Expand Up @@ -463,10 +574,27 @@ def setUpTestData(self):



class ItemSoftwareTicketPermissionsAPI(
class ItemServiceTicketPermissionsAPI(
ItemService,
BaseItemTicketPermissionsAPI,
TestCase
):

pass



class ItemServiceTicketSerializer(
ItemService,
BaseItemTicketSerializer,
TestCase
):

pass



class ItemSoftware:
""" Test Cases common to ALL ticket types """


Expand Down Expand Up @@ -497,3 +625,21 @@ def setUpTestData(self):
super().setUpTestData()



class ItemSoftwareTicketPermissionsAPI(
ItemSoftware,
BaseItemTicketPermissionsAPI,
TestCase
):

pass



class ItemSoftwareTicketSerializer(
ItemSoftware,
BaseItemTicketSerializer,
TestCase
):

pass

0 comments on commit 04a090c

Please sign in to comment.