22
22
from jira import JIRA , Issue , JIRAError
23
23
from jira .client import ResultList
24
24
from jira .resources import Dashboard , Resource , cls_for_resource
25
- from tests .conftest import JiraTestCase , rndpassword
25
+ from tests .conftest import JiraTestCase , allow_on_cloud , rndpassword
26
26
27
27
LOGGER = logging .getLogger (__name__ )
28
28
@@ -154,9 +154,9 @@ def test_fields(self):
154
154
self .assertGreater (len (fields ), 10 )
155
155
156
156
157
- class MyPermissionsTests (JiraTestCase ):
157
+ class MyPermissionsServerTests (JiraTestCase ):
158
158
def setUp (self ):
159
- JiraTestCase .setUp (self )
159
+ super () .setUp ()
160
160
self .issue_1 = self .test_manager .project_b_issue1
161
161
162
162
def test_my_permissions (self ):
@@ -178,6 +178,49 @@ def test_my_permissions_by_issue(self):
178
178
self .assertGreaterEqual (len (perms ["permissions" ]), 10 )
179
179
180
180
181
+ @allow_on_cloud
182
+ class MyPermissionsCloudTests (JiraTestCase ):
183
+ def setUp (self ):
184
+ super ().setUp ()
185
+ if not self .jira ._is_cloud :
186
+ self .skipTest ("cloud only test class" )
187
+ self .issue_1 = self .test_manager .project_b_issue1
188
+ self .permission_keys = "BROWSE_PROJECTS,CREATE_ISSUES,ADMINISTER_PROJECTS"
189
+
190
+ def test_my_permissions (self ):
191
+ perms = self .jira .my_permissions (permissions = self .permission_keys )
192
+ self .assertEqual (len (perms ["permissions" ]), 3 )
193
+
194
+ def test_my_permissions_by_project (self ):
195
+ perms = self .jira .my_permissions (
196
+ projectKey = self .test_manager .project_a , permissions = self .permission_keys
197
+ )
198
+ self .assertEqual (len (perms ["permissions" ]), 3 )
199
+ perms = self .jira .my_permissions (
200
+ projectId = self .test_manager .project_a_id , permissions = self .permission_keys
201
+ )
202
+ self .assertEqual (len (perms ["permissions" ]), 3 )
203
+
204
+ def test_my_permissions_by_issue (self ):
205
+ perms = self .jira .my_permissions (
206
+ issueKey = self .issue_1 , permissions = self .permission_keys
207
+ )
208
+ self .assertEqual (len (perms ["permissions" ]), 3 )
209
+ perms = self .jira .my_permissions (
210
+ issueId = self .test_manager .project_b_issue1_obj .id ,
211
+ permissions = self .permission_keys ,
212
+ )
213
+ self .assertEqual (len (perms ["permissions" ]), 3 )
214
+
215
+ def test_missing_required_param_my_permissions_raises_exception (self ):
216
+ with self .assertRaises (JIRAError ):
217
+ self .jira .my_permissions ()
218
+
219
+ def test_invalid_param_my_permissions_raises_exception (self ):
220
+ with self .assertRaises (JIRAError ):
221
+ self .jira .my_permissions ("INVALID_PERMISSION" )
222
+
223
+
181
224
class SearchTests (JiraTestCase ):
182
225
def setUp (self ):
183
226
JiraTestCase .setUp (self )
0 commit comments