forked from mozilla/jira-bugzilla-integration
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ref mozilla#984: Simple comment when attachment is added to bug (mozi…
…lla#1018) * Add attachment operation * Call 'create_comment' by default on attachment events * Add comment by default when an attachment is created * Improve past verb in comment
- Loading branch information
Showing
8 changed files
with
78 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -165,6 +165,18 @@ def context_comment_example(action_context_factory) -> ActionContext: | |
) | ||
|
||
|
||
@pytest.fixture | ||
def context_attachment_example(action_context_factory) -> ActionContext: | ||
return action_context_factory( | ||
operation=Operation.ATTACHMENT, | ||
bug__see_also=["https://mozilla.atlassian.net/browse/JBI-234"], | ||
event__target="attachment", | ||
event__routed_key="attachment.create", | ||
event__user__login="[email protected]", | ||
jira__issue="JBI-234", | ||
) | ||
|
||
|
||
@pytest.fixture(autouse=True) | ||
def sleepless(monkeypatch): | ||
# https://stackoverflow.com/a/54829577 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -234,6 +234,21 @@ def test_added_comment( | |
) | ||
|
||
|
||
def test_added_attachment( | ||
context_attachment_example: ActionContext, mocked_jira, action_params_factory | ||
): | ||
callable_object = Executor( | ||
action_params_factory(jira_project_key=context_attachment_example.jira.project) | ||
) | ||
|
||
callable_object(context=context_attachment_example) | ||
|
||
mocked_jira.issue_add_comment.assert_called_once_with( | ||
issue_key="JBI-234", | ||
comment="*[email protected]* created an attachment", | ||
) | ||
|
||
|
||
def test_empty_comment_not_added( | ||
action_context_factory, mocked_jira, action_params_factory | ||
): | ||
|