-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(config_management): Config Groups Note API ViewSet permission ch…
- Loading branch information
Showing
1 changed file
with
55 additions
and
0 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
app/config_management/tests/unit/config_groups/test_config_groups_notes_viewset.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} |