Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add required parameter field 'permissions' to my_permissions method #1472

Merged
4 changes: 4 additions & 0 deletions jira/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2634,6 +2634,10 @@ def my_permissions(
) -> Dict[str, Dict[str, Dict[str, str]]]:
"""Get a dict of all available permissions on the server.

``permissions`` is a comma-separated value list of permission keys that is
required in Jira Cloud. For possible and allowable permission values, see
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-permission-schemes/#built-in-permissions

Comment on lines +2637 to +2640
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent

Args:
projectKey (Optional[str]): limit returned permissions to the specified project
projectId (Optional[str]): limit returned permissions to the specified project
Expand Down
9 changes: 6 additions & 3 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from jira import JIRA, Issue, JIRAError
from jira.client import ResultList
from jira.resources import Dashboard, Resource, cls_for_resource
from tests.conftest import JiraTestCase, rndpassword
from tests.conftest import JiraTestCase, allow_on_cloud, rndpassword

LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -157,8 +157,6 @@ def test_fields(self):
class MyPermissionsServerTests(JiraTestCase):
def setUp(self):
super().setUp()
if self.jira._is_cloud:
self.skipTest("server only test class")
self.issue_1 = self.test_manager.project_b_issue1

def test_my_permissions(self):
Expand All @@ -180,6 +178,7 @@ def test_my_permissions_by_issue(self):
self.assertGreaterEqual(len(perms["permissions"]), 10)


@allow_on_cloud
class MyPermissionsCloudTests(JiraTestCase):
codectl marked this conversation as resolved.
Show resolved Hide resolved
def setUp(self):
super().setUp()
Expand Down Expand Up @@ -213,6 +212,10 @@ def test_my_permissions_by_issue(self):
)
self.assertEqual(len(perms["permissions"]), 3)

def test_missing_required_param_my_permissions_raises_exception(self):
with self.assertRaises(JIRAError):
self.jira.my_permissions()

def test_invalid_param_my_permissions_raises_exception(self):
with self.assertRaises(JIRAError):
self.jira.my_permissions("INVALID_PERMISSION")
Expand Down