← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/git-mp-delete-view into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/git-mp-delete-view into lp:launchpad.

Commit message:
Fix links to Git references on BranchMergeProposal:+delete.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/git-mp-delete-view/+merge/258057

Fix links to Git references on BranchMergeProposal:+delete.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/git-mp-delete-view into lp:launchpad.
=== modified file 'lib/lp/code/browser/tests/test_branchmergeproposal.py'
--- lib/lp/code/browser/tests/test_branchmergeproposal.py	2015-04-28 16:48:22 +0000
+++ lib/lp/code/browser/tests/test_branchmergeproposal.py	2015-05-01 17:00:32 +0000
@@ -80,6 +80,7 @@
     DatabaseFunctionalLayer,
     LaunchpadFunctionalLayer,
     )
+from lp.testing.pages import find_tag_by_id
 from lp.testing.views import create_initialized_view
 
 
@@ -1566,3 +1567,41 @@
     def _setBranchInvisible(branch):
         removeSecurityProxy(branch.repository).transitionToInformationType(
             InformationType.USERDATA, branch.owner, verify_policy=False)
+
+
+class TestBranchMergeProposalDeleteViewMixin:
+    """Test the BranchMergeProposal deletion view."""
+
+    layer = DatabaseFunctionalLayer
+
+    def test_links(self):
+        bmp = self._makeBranchMergeProposal()
+        view = create_initialized_view(
+            bmp, "+delete", principal=bmp.registrant)
+        content = view()
+        self.assertEqual(
+            canonical_url(bmp.merge_source),
+            find_tag_by_id(content, "source-link").find("a")["href"])
+        self.assertEqual(
+            canonical_url(bmp.merge_target),
+            find_tag_by_id(content, "target-link").find("a")["href"])
+
+
+class TestBranchMergeProposalDeleteViewBzr(
+    TestBranchMergeProposalDeleteViewMixin, TestCaseWithFactory):
+    """Test the BranchMergeProposal deletion view for Bazaar."""
+
+    def _makeBranchMergeProposal(self, **kwargs):
+        return self.factory.makeBranchMergeProposal(**kwargs)
+
+
+class TestBranchMergeProposalDeleteViewGit(
+    TestBranchMergeProposalDeleteViewMixin, TestCaseWithFactory):
+    """Test the BranchMergeProposal deletion view for Git."""
+
+    def setUp(self):
+        super(TestBranchMergeProposalDeleteViewGit, self).setUp()
+        self.useFixture(FeatureFixture({GIT_FEATURE_FLAG: u"on"}))
+
+    def _makeBranchMergeProposal(self, **kwargs):
+        return self.factory.makeBranchMergeProposalForGit(**kwargs)

=== modified file 'lib/lp/code/templates/branchmergeproposal-delete.pt'
--- lib/lp/code/templates/branchmergeproposal-delete.pt	2009-08-19 08:40:56 +0000
+++ lib/lp/code/templates/branchmergeproposal-delete.pt	2015-05-01 17:00:32 +0000
@@ -16,11 +16,13 @@
         <tbody>
           <tr>
             <th>Source branch:</th>
-            <td tal:content="structure context/source_branch/fmt:link">lp:~foo/bar/baz</td>
+            <td id="source-link"
+                tal:content="structure context/merge_source/fmt:link">lp:~foo/bar/baz</td>
           </tr>
           <tr>
             <th>Target branch:</th>
-            <td tal:content="structure context/target_branch/fmt:link">lp:bar</td>
+            <td id="target-link"
+                tal:content="structure context/merge_target/fmt:link">lp:bar</td>
           </tr>
         </tbody>
       </table>


Follow ups