Skip to content

Commit

Permalink
test(config_management): Config Groups Note API ViewSet permission ch…
Browse files Browse the repository at this point in the history
…ecks

ref: #15 #49 #248 #354
  • Loading branch information
jon-nfc committed Oct 18, 2024
1 parent 6af59e1 commit fd126f0
Showing 1 changed file with 55 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import pytest

from django.test import TestCase

from core.tests.abstract.test_notes_viewset import NoteViewSetCommon

from core.models.notes import Notes

from config_management.models.groups import ConfigGroups



class NotePermissionsAPI(
NoteViewSetCommon,
TestCase,
):

app_namespace = 'API'

url_name = '_api_v2_config_group_notes'


@classmethod
def setUpTestData(self):
"""Setup Test
1. Create an organization for user and item
. create an organization that is different to item
2. Create a team
3. create teams with each permission: view, add, change, delete
4. create a user per team
"""

super().setUpTestData()



self.note_item = ConfigGroups.objects.create(
organization = self.organization,
name = 'history-device'
)

self.item = Notes.objects.create(
organization = self.organization,
note = 'a note',
usercreated = self.view_user,
config_group = self.note_item
)


self.url_kwargs = {'group_id': self.note_item.id}

self.url_view_kwargs = {'group_id': self.note_item.id, 'pk': self.item.pk }

self.add_data = {'note': 'a note added', 'organization': self.organization.id}

0 comments on commit fd126f0

Please sign in to comment.