|
25 | 25 | "maybe_assign_jira_user", |
26 | 26 | "maybe_update_issue_status", |
27 | 27 | "maybe_update_issue_resolution", |
| 28 | + "maybe_add_phabricator_link", |
28 | 29 | ], |
29 | 30 | "comment": [ |
30 | 31 | "create_comment", |
@@ -245,7 +246,36 @@ def test_added_attachment( |
245 | 246 |
|
246 | 247 | mocked_jira.issue_add_comment.assert_called_once_with( |
247 | 248 | issue_key="JBI-234", |
248 | | - comment="*[email protected]* created an attachment:\n*Description*: Bug 1337 - Stop war r?peace\n*Filename*: phabricator-D1234-url.txt (text/x-phabricator-request)", |
| 249 | + comment="*[email protected]* created an attachment:\n*Description*: Bug 1337 - Stop war r?peace\n*Filename*: phabricator-D1234-url.txt (text/x-phabricator-request)\n*Phabricator URL*: https://phabricator.services.mozilla.com/D1234", |
| 250 | + ) |
| 251 | + |
| 252 | +def test_added_phabricator_attachment( |
| 253 | + action_context_factory, mocked_jira, action_params_factory |
| 254 | +): |
| 255 | + phabricator_attachment_context = action_context_factory( |
| 256 | + operation=Operation.ATTACHMENT, |
| 257 | + bug__with_attachment=True, |
| 258 | + bug__id=5555, |
| 259 | + bug__attachment__is_patch=True, |
| 260 | + bug__attachment__is_obsolete=False, |
| 261 | + bug__attachment__id=123456, |
| 262 | + bug__attachment__file_name="phabricator-D1234-url.txt", |
| 263 | + bug__attachment__description="Bug 1234 - Fix all the bugs", |
| 264 | + bug__attachment__content_type="text/x-phabricator-request", |
| 265 | + event__target="attachment", |
| 266 | + jira__issue="JBI-234", |
| 267 | + ) |
| 268 | + callable_object = Executor( |
| 269 | + action_params_factory(jira_project_key=phabricator_attachment_context.jira.project) |
| 270 | + ) |
| 271 | + |
| 272 | + callable_object(context=phabricator_attachment_context) |
| 273 | + |
| 274 | + mocked_jira.create_or_update_issue_remote_links.assert_called_once_with( |
| 275 | + issue_key="JBI-234", |
| 276 | + link_url="https://phabricator.services.mozilla.com/D1234", |
| 277 | + title="Bug 1234 - Fix all the bugs", |
| 278 | + global_id="5555-123456", |
249 | 279 | ) |
250 | 280 |
|
251 | 281 |
|
|
0 commit comments