Skip to content

Commit 03f21f6

Browse files
Add: Remote link: Application
1 parent 7808bee commit 03f21f6

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

atlassian/jira.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1776,6 +1776,7 @@ def create_or_update_issue_remote_links(
17761776
icon_url=None,
17771777
icon_title=None,
17781778
status_resolved=False,
1779+
application: dict = {},
17791780
):
17801781
"""
17811782
Add Remote Link to Issue, update url if global_id is passed
@@ -1787,6 +1788,7 @@ def create_or_update_issue_remote_links(
17871788
:param icon_url: str, OPTIONAL: Link to a 16x16 icon representing the type of the object in the remote system
17881789
:param icon_title: str, OPTIONAL: Text for the tooltip of the main icon describing the type of the object in the remote system
17891790
:param status_resolved: bool, OPTIONAL: if set to True, Jira renders the link strikethrough
1791+
:param application: dict, OPTIONAL: Application description
17901792
"""
17911793
base_url = self.resource_url("issue")
17921794
url = "{base_url}/{issue_key}/remotelink".format(base_url=base_url, issue_key=issue_key)
@@ -1802,6 +1804,8 @@ def create_or_update_issue_remote_links(
18021804
if icon_title:
18031805
icon_data["title"] = icon_title
18041806
data["object"]["icon"] = icon_data
1807+
if application:
1808+
data["application"] = application
18051809
return self.post(url, data=data)
18061810

18071811
def get_issue_remote_link_by_id(self, issue_key, link_id):

tests/responses/jira/rest/api/2/issue/FOO-123/remotelink/POST

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,13 @@ responses[
55
"self": "https://atlassian-python.atlassian.net/rest/api/2/issue/FOO-123/remotelink/10000",
66
"application": {},
77
}
8+
responses[
9+
'{"object": {"url": "https://confluence.atlassian-python.atlassian.net/display/Test", "title": "Unused link text", "status": {"resolved": false}}, "globalId": "appId=00000000-0000-0000-0000-000000000000&pageId=0", "application": {"type": "com.atlassian.confluence", "name": "Confluence"}}'
10+
] = {
11+
"id": 10000,
12+
"self": "https://atlassian-python.atlassian.net/rest/api/2/issue/FOO-123/remotelink/10000",
13+
"application": {
14+
"type": "com.atlassian.confluence",
15+
"name": "Confluence",
16+
},
17+
}

tests/test_jira.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,24 @@ def test_post_issue_remotelink(self):
105105
resp["self"], "https://atlassian-python.atlassian.net/rest/api/2/issue/FOO-123/remotelink/10000"
106106
)
107107
self.assertDictEqual(resp['application'], {})
108+
109+
def test_post_issue_remotelink_confluence(self):
110+
"""Create a new Confluence remote link"""
111+
resp = self.jira.create_or_update_issue_remote_links(
112+
"FOO-123",
113+
"https://confluence.atlassian-python.atlassian.net/display/Test",
114+
"Unused link text",
115+
global_id="appId=00000000-0000-0000-0000-000000000000&pageId=0",
116+
application={
117+
"type": "com.atlassian.confluence",
118+
"name": "Confluence",
119+
},
120+
)
121+
self.assertEqual(resp["id"], 10000)
122+
self.assertEqual(
123+
resp["self"], "https://atlassian-python.atlassian.net/rest/api/2/issue/FOO-123/remotelink/10000"
124+
)
125+
self.assertDictEqual(resp['application'], {
126+
"type": "com.atlassian.confluence",
127+
"name": "Confluence",
128+
})

0 commit comments

Comments
 (0)