Merge ~ilasc/launchpad:bug-530505 into launchpad:master

Proposed by Ioana Lasc
Status: Merged
Approved by: Colin Watson
Approved revision: c363c5165e98a18704cbb7439ac3c36ea17ad224
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~ilasc/launchpad:bug-530505
Merge into: launchpad:master
Diff against target: 55 lines (+20/-2)
3 files modified
lib/lp/code/interfaces/branchmergeproposal.py (+1/-1)
lib/lp/code/model/branchmergeproposal.py (+1/-1)
lib/lp/code/model/tests/test_branchmergeproposal.py (+18/-0)
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+374197@code.launchpad.net

Commit message

Made Subject not required in apidoc parameters for branch_merge_proposal.createComment.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Needs Fixing
Revision history for this message
Ioana Lasc (ilasc) wrote :

Test was moved to appropriate file. Branch is now ready for a second review.

Revision history for this message
Colin Watson (cjwatson) wrote :

Looks good to me now, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/code/interfaces/branchmergeproposal.py b/lib/lp/code/interfaces/branchmergeproposal.py
2index 54bef77..fa37faf 100644
3--- a/lib/lp/code/interfaces/branchmergeproposal.py
4+++ b/lib/lp/code/interfaces/branchmergeproposal.py
5@@ -692,7 +692,7 @@ class IBranchMergeProposalAnyAllowedPerson(IBugLinkTarget):
6 @call_with(owner=REQUEST_USER)
7 # ICodeReviewComment supplied as Interface to avoid circular imports.
8 @export_factory_operation(Interface, [])
9- def createComment(owner, subject, content=None, vote=None,
10+ def createComment(owner, subject=None, content=None, vote=None,
11 review_type=None, parent=None,
12 previewdiff_id=None, inline_comments=None):
13 """Create an ICodeReviewComment associated with this merge proposal.
14diff --git a/lib/lp/code/model/branchmergeproposal.py b/lib/lp/code/model/branchmergeproposal.py
15index 0241e7c..5ebcf04 100644
16--- a/lib/lp/code/model/branchmergeproposal.py
17+++ b/lib/lp/code/model/branchmergeproposal.py
18@@ -998,7 +998,7 @@ class BranchMergeProposal(SQLBase, BugLinkTargetMixin):
19 stop=self.target_git_commit_sha1,
20 union_repository=self.target_git_repository)
21
22- def createComment(self, owner, subject, content=None, vote=None,
23+ def createComment(self, owner, subject=None, content=None, vote=None,
24 review_type=None, parent=None, _date_created=DEFAULT,
25 previewdiff_id=None, inline_comments=None,
26 _notify_listeners=True):
27diff --git a/lib/lp/code/model/tests/test_branchmergeproposal.py b/lib/lp/code/model/tests/test_branchmergeproposal.py
28index c899c10..a533d4b 100644
29--- a/lib/lp/code/model/tests/test_branchmergeproposal.py
30+++ b/lib/lp/code/model/tests/test_branchmergeproposal.py
31@@ -2543,6 +2543,24 @@ class TestBranchMergeProposalInlineComments(TestCaseWithFactory):
32 self.assertEqual(1, len(self.getInlineComments()))
33 self.assertEqual(1, self.bmp.all_comments.count())
34
35+ def test_publish_no_subject_on_comment(self):
36+ # Not passing in a Subject when creating a comment
37+ # does not fail and the MP comment is created
38+ # with the default subject.
39+ self.bmp.createComment(
40+ owner=self.bmp.registrant,
41+ previewdiff_id=self.previewdiff.id,
42+ inline_comments=None,
43+ content='Test comment'
44+ )
45+ self.assertEqual(1, self.bmp.all_comments.count())
46+ comment = self.bmp.all_comments[0]
47+ self.assertEqual('Test comment', comment.message.chunks[0].content)
48+ self.assertEqual(
49+ 'Re: [Merge] %s into %s' % (
50+ self.bmp.source_branch.bzr_identity,
51+ self.bmp.target_branch.bzr_identity), comment.message.subject)
52+
53 def test_publish_no_inlines(self):
54 # Suppressing 'inline_comments' does not result in any inline
55 # comments, but the MP comment itself is created.

Subscribers

People subscribed via source and target branches

to status/vote changes: