Skip to content

Commit 4780acc

Browse files
Add: Remote link: Application (#1429)
1 parent 447ad1e commit 4780acc

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-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):
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
responses['{"issue_key": "FOO-123", "link_url": "https://confluence.atlassian-python.atlassian.net/display/Test", "title": "Unused link text", "global_id": "appId=00000000-0000-0000-0000-000000000000&pageId=0", application={"type": "com.atlassian.confluence", "name": "Confluence"}}'] = {
2+
"id": 10000,
3+
"self": "https://atlassian-python.atlassian.net/rest/api/2/issue/FOO-123/remotelink/10000",
4+
}

tests/test_jira.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,18 @@ def test_delete_issue_property_not_found(self):
9292
self.jira.get_issue_property("FOO-123", "NotFoundBar1")
9393
with self.assertRaises(HTTPError):
9494
self.jira.get_issue_property("FOONotFound-123", "NotFoundBar1")
95+
96+
def test_post_issue_remotelink(self):
97+
"""Create a new Confluence remote link"""
98+
resp = self.jira.create_or_update_issue_remote_links(
99+
"FOO-123",
100+
"https://confluence.atlassian-python.atlassian.net/display/Test",
101+
"Unused link text",
102+
global_id="appId=00000000-0000-0000-0000-000000000000&pageId=0",
103+
application={
104+
"type": "com.atlassian.confluence",
105+
"name": "Confluence",
106+
},
107+
)
108+
self.assertEqual(resp["id"], "10000")
109+
self.assertEqual(resp["self"], "https://atlassian-python.atlassian.net/rest/api/2/issue/FOO-123/remotelink/10000")

0 commit comments

Comments
 (0)