~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/code/model/tests/test_branch.py

  • Committer: Ian Booth
  • Date: 2011-08-23 06:55:33 UTC
  • mto: This revision was merged to the branch mainline in revision 13814.
  • Revision ID: ian.booth@canonical.com-20110823065533-xp8r12jmeiuj9fuo
A branch is private if it is stacked on any private branches

Show diffs side-by-side

added added

removed removed

Lines of Context:
2168
2168
        self.assertEqual(True, branch.pending_writes)
2169
2169
 
2170
2170
 
 
2171
class TestBranchPrivacy(TestCaseWithFactory):
 
2172
    """Tests for branch privacy."""
 
2173
 
 
2174
    layer = DatabaseFunctionalLayer
 
2175
 
 
2176
    def setUp(self):
 
2177
        # Use an admin user as we aren't checking edit permissions here.
 
2178
        TestCaseWithFactory.setUp(self, 'admin@canonical.com')
 
2179
 
 
2180
    def test_public_stacked_on_private_is_private(self):
 
2181
        # A public branch stacked on a private branch is private.
 
2182
        stacked_on = self.factory.makeBranch(private=True)
 
2183
        branch = self.factory.makeBranch(stacked_on=stacked_on, private=False)
 
2184
        self.assertTrue(branch.private)
 
2185
 
 
2186
    def test_private_stacked_on_public_is_private(self):
 
2187
        # A public branch stacked on a private branch is private.
 
2188
        stacked_on = self.factory.makeBranch(private=False)
 
2189
        branch = self.factory.makeBranch(stacked_on=stacked_on, private=True)
 
2190
        self.assertTrue(branch.private)
 
2191
 
 
2192
 
2171
2193
class TestBranchSetPrivate(TestCaseWithFactory):
2172
2194
    """Test IBranch.setPrivate."""
2173
2195