Skip to content

Commit

Permalink
test(project_management): Project Milestone api permission checks
Browse files Browse the repository at this point in the history
ref: #301 closes #285 closes #295
  • Loading branch information
jon-nfc committed Sep 18, 2024
1 parent cf73323 commit 0ae1395
Showing 1 changed file with 22 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,27 @@

from django.contrib.auth.models import AnonymousUser, User
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
from django.shortcuts import reverse
from django.test import Client, TestCase

from access.models import Organization, Team, TeamUsers, Permission

from api.tests.abstract.api_permissions import APIPermissions

from project_management.models.projects import Project
from project_management.models.project_milestone import Project, ProjectMilestone


@pytest.mark.skip(reason='to be developed')
class ProjectMilestonePermissionsAPI(TestCase, APIPermissions):


model = ProjectMilestone

app_namespace = 'API'

url_name = '_api_ticket_comment_category-detail'
url_name = '_api_project_milestone-detail'

url_list = '_api_ticket_comment_category-list'
url_list = '_api_project_milestone-list'

change_data = {'name': 'category'}

Expand All @@ -47,18 +48,23 @@ def setUpTestData(self):

different_organization = Organization.objects.create(name='test_different_organization')

self.project = Project.objects.create(
name='a proj',
organization=self.organization,
)

self.item = self.model.objects.create(
organization=organization,
name = 'softwareone'
name = 'softwareone',
project = self.project,
)


# self.url_kwargs = {'pk': self.item.id}
self.url_kwargs = {'project_id': self.project.id,}

self.url_view_kwargs = {'pk': self.item.id}
self.url_view_kwargs = {'project_id': self.project.id, 'pk': self.item.id}

self.add_data = {'name': 'software', 'organization': self.organization.id}
self.add_data = {'name': 'software', 'organization': self.organization.id, 'project': self.project.id}


view_permissions = Permission.objects.get(
Expand Down Expand Up @@ -175,3 +181,11 @@ def setUpTestData(self):
team = different_organization_team,
user = self.different_organization_user
)


# fetch fields to confirm availability.
# client = Client()
# url = reverse(self.app_namespace + ':' + self.url_name, kwargs=self.url_view_kwargs)

# client.force_login(self.view_user)
# self.view_response = client.get(url)

0 comments on commit 0ae1395

Please sign in to comment.