Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ compatibility)
- `POST` an item to a project
- `POST` item attachment
- `POST` item sync
- `POST` Executes a workflow transition for the item with the specified item ID
- `POST` a tag to an item
- `PUT` an item
- `PUT` item lock
Expand Down
25 changes: 25 additions & 0 deletions py_jama_rest_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1193,6 +1193,31 @@ def post_item_sync(self, source_item: int, pool_item: int):
JamaClient.__handle_response_status(response)
return response.json()['meta']['id']

def post_item_workflow_transitions(self, item_id, transition_id, comment=''):
"""
Executes a workflow transition for the item with the specified ID

Args:
item_id: the api id of the item
transition_id: the api id of the tranistion status
comment: short description about the item transition

Returns: 201 if successful
"""
resource_path = 'items/'+ str(item_id) + '/workflowtransitions'
body = {
'transitionId': transition_id,
'comment': comment
}
headers = {'content-type': 'application/json'}
try:
response = self.__core.post(resource_path, data=json.dumps(body), headers=headers)
except CoreException as err:
py_jama_rest_client_logger.error(err)
raise APIException(str(err))
JamaClient.__handle_response_status(response)
return response.status_code

def post_relationship(self, from_item: int, to_item: int, relationship_type=None):
"""

Expand Down
8 changes: 8 additions & 0 deletions test/test_jamaClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,14 @@ def test_post_item_sync(self):
sync = self.jama_client.post_item_sync(source_item, pool_item)
self.assertIsNotNone(sync)

@unittest.skip('Entity Already Exists')
def test_post_item_workflow_transitions(self):
item_id = 10410
transition_id = "566_700"
comment = "Draft to Ready for Review"
res_status = self.jama_client.post_item_workflow_transitions(item_id,transition_id,comment)
self.assertEqual(res_status, 201)

@unittest.skip('Entity Already Exists')
def test_post_relationship(self):
from_item = 104755
Expand Down