Merge lp:~stevenk/launchpad/branch-use-information_type-redux into lp:launchpad
- branch-use-information_type-redux
- Merge into devel
Proposed by
Steve Kowalik
Status: | Merged |
---|---|
Approved by: | Steve Kowalik |
Approved revision: | no longer in the source branch. |
Merged at revision: | 15307 |
Proposed branch: | lp:~stevenk/launchpad/branch-use-information_type-redux |
Merge into: | lp:launchpad |
Diff against target: |
603 lines (+135/-100) 18 files modified
lib/lp/app/browser/tests/test_launchpad.py (+6/-3) lib/lp/code/browser/tests/test_branch.py (+6/-3) lib/lp/code/browser/tests/test_branchmergeproposal.py (+2/-1) lib/lp/code/errors.py (+5/-0) lib/lp/code/interfaces/branch.py (+7/-4) lib/lp/code/model/branch.py (+35/-12) lib/lp/code/model/tests/test_branch.py (+29/-3) lib/lp/code/model/tests/test_branchlookup.py (+2/-1) lib/lp/code/model/tests/test_branchmergeproposal.py (+4/-3) lib/lp/code/model/tests/test_branchvisibility.py (+4/-7) lib/lp/code/model/tests/test_sourcepackagerecipe.py (+3/-1) lib/lp/code/model/tests/test_sourcepackagerecipebuild.py (+4/-2) lib/lp/code/stories/branches/xx-branch-edit-privacy.txt (+0/-33) lib/lp/code/stories/branches/xx-branch-index.txt (+0/-15) lib/lp/code/xmlrpc/tests/test_branch.py (+4/-2) lib/lp/registry/stories/product/xx-product-development-focus.txt (+6/-2) lib/lp/testing/factory.py (+14/-6) lib/lp/translations/tests/test_translationtemplatesbuildjob.py (+4/-2) |
To merge this branch: | bzr merge lp:~stevenk/launchpad/branch-use-information_type-redux |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
William Grant | code | Approve | |
Review via email: mp+107150@code.launchpad.net |
Commit message
Switch Branch to using information_type to check privacy by default.
Description of the change
Building on https:/
I have fixed the test failures, and have changed transitionToInf
To post a comment you must log in.
Revision history for this message
William Grant (wgrant) : | # |
review:
Approve
(code)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'lib/lp/app/browser/tests/test_launchpad.py' | |||
2 | --- lib/lp/app/browser/tests/test_launchpad.py 2012-02-23 23:44:00 +0000 | |||
3 | +++ lib/lp/app/browser/tests/test_launchpad.py 2012-05-25 01:57:19 +0000 | |||
4 | @@ -1,4 +1,4 @@ | |||
6 | 1 | # Copyright 2009-2011 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2012 Canonical Ltd. This software is licensed under the |
7 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
8 | 3 | 3 | ||
9 | 4 | """Tests for traversal from the root branch object.""" | 4 | """Tests for traversal from the root branch object.""" |
10 | @@ -20,6 +20,7 @@ | |||
11 | 20 | from lp.app.errors import GoneError | 20 | from lp.app.errors import GoneError |
12 | 21 | from lp.app.interfaces.launchpad import ILaunchpadCelebrities | 21 | from lp.app.interfaces.launchpad import ILaunchpadCelebrities |
13 | 22 | from lp.code.interfaces.linkedbranch import ICanHasLinkedBranch | 22 | from lp.code.interfaces.linkedbranch import ICanHasLinkedBranch |
14 | 23 | from lp.registry.enums import InformationType | ||
15 | 23 | from lp.registry.interfaces.person import ( | 24 | from lp.registry.interfaces.person import ( |
16 | 24 | IPersonSet, | 25 | IPersonSet, |
17 | 25 | PersonVisibility, | 26 | PersonVisibility, |
18 | @@ -192,7 +193,8 @@ | |||
19 | 192 | branch = self.factory.makeProductBranch() | 193 | branch = self.factory.makeProductBranch() |
20 | 193 | naked_product = removeSecurityProxy(branch.product) | 194 | naked_product = removeSecurityProxy(branch.product) |
21 | 194 | ICanHasLinkedBranch(naked_product).setBranch(branch) | 195 | ICanHasLinkedBranch(naked_product).setBranch(branch) |
23 | 195 | removeSecurityProxy(branch).explicitly_private = True | 196 | removeSecurityProxy(branch).information_type = ( |
24 | 197 | InformationType.USERDATA) | ||
25 | 196 | login(ANONYMOUS) | 198 | login(ANONYMOUS) |
26 | 197 | requiredMessage = ( | 199 | requiredMessage = ( |
27 | 198 | u"The target %s does not have a linked branch." % | 200 | u"The target %s does not have a linked branch." % |
28 | @@ -218,7 +220,8 @@ | |||
29 | 218 | branch = self.factory.makeProductBranch() | 220 | branch = self.factory.makeProductBranch() |
30 | 219 | naked_product = removeSecurityProxy(branch.product) | 221 | naked_product = removeSecurityProxy(branch.product) |
31 | 220 | ICanHasLinkedBranch(naked_product).setBranch(branch) | 222 | ICanHasLinkedBranch(naked_product).setBranch(branch) |
33 | 221 | removeSecurityProxy(branch).explicitly_private = True | 223 | removeSecurityProxy(branch).information_type = ( |
34 | 224 | InformationType.USERDATA) | ||
35 | 222 | login(ANONYMOUS) | 225 | login(ANONYMOUS) |
36 | 223 | self.assertNotFound(naked_product.name, use_default_referer=False) | 226 | self.assertNotFound(naked_product.name, use_default_referer=False) |
37 | 224 | 227 | ||
38 | 225 | 228 | ||
39 | === modified file 'lib/lp/code/browser/tests/test_branch.py' | |||
40 | --- lib/lp/code/browser/tests/test_branch.py 2012-05-23 22:27:56 +0000 | |||
41 | +++ lib/lp/code/browser/tests/test_branch.py 2012-05-25 01:57:19 +0000 | |||
42 | @@ -758,7 +758,8 @@ | |||
43 | 758 | # If the target is private, the landing targets should not include it. | 758 | # If the target is private, the landing targets should not include it. |
44 | 759 | bmp = self.factory.makeBranchMergeProposal() | 759 | bmp = self.factory.makeBranchMergeProposal() |
45 | 760 | branch = bmp.source_branch | 760 | branch = bmp.source_branch |
47 | 761 | removeSecurityProxy(bmp.target_branch).explicitly_private = True | 761 | removeSecurityProxy(bmp.target_branch).information_type = ( |
48 | 762 | InformationType.USERDATA) | ||
49 | 762 | view = BranchView(branch, LaunchpadTestRequest()) | 763 | view = BranchView(branch, LaunchpadTestRequest()) |
50 | 763 | self.assertTrue(view.no_merges) | 764 | self.assertTrue(view.no_merges) |
51 | 764 | self.assertEqual([], view.landing_targets) | 765 | self.assertEqual([], view.landing_targets) |
52 | @@ -779,7 +780,8 @@ | |||
53 | 779 | # it. | 780 | # it. |
54 | 780 | bmp = self.factory.makeBranchMergeProposal() | 781 | bmp = self.factory.makeBranchMergeProposal() |
55 | 781 | branch = bmp.target_branch | 782 | branch = bmp.target_branch |
57 | 782 | removeSecurityProxy(bmp.source_branch).explicitly_private = True | 783 | removeSecurityProxy(bmp.source_branch).information_type = ( |
58 | 784 | InformationType.USERDATA) | ||
59 | 783 | view = BranchView(branch, LaunchpadTestRequest()) | 785 | view = BranchView(branch, LaunchpadTestRequest()) |
60 | 784 | self.assertTrue(view.no_merges) | 786 | self.assertTrue(view.no_merges) |
61 | 785 | self.assertEqual([], view.landing_candidates) | 787 | self.assertEqual([], view.landing_candidates) |
62 | @@ -799,7 +801,8 @@ | |||
63 | 799 | # the target is private, then the dependent_branches are not shown. | 801 | # the target is private, then the dependent_branches are not shown. |
64 | 800 | branch = self.factory.makeProductBranch() | 802 | branch = self.factory.makeProductBranch() |
65 | 801 | bmp = self.factory.makeBranchMergeProposal(prerequisite_branch=branch) | 803 | bmp = self.factory.makeBranchMergeProposal(prerequisite_branch=branch) |
67 | 802 | removeSecurityProxy(bmp.source_branch).explicitly_private = True | 804 | removeSecurityProxy(bmp.source_branch).information_type = ( |
68 | 805 | InformationType.USERDATA) | ||
69 | 803 | view = BranchView(branch, LaunchpadTestRequest()) | 806 | view = BranchView(branch, LaunchpadTestRequest()) |
70 | 804 | self.assertTrue(view.no_merges) | 807 | self.assertTrue(view.no_merges) |
71 | 805 | self.assertEqual([], view.dependent_branches) | 808 | self.assertEqual([], view.dependent_branches) |
72 | 806 | 809 | ||
73 | === modified file 'lib/lp/code/browser/tests/test_branchmergeproposal.py' | |||
74 | --- lib/lp/code/browser/tests/test_branchmergeproposal.py 2012-05-23 22:27:56 +0000 | |||
75 | +++ lib/lp/code/browser/tests/test_branchmergeproposal.py 2012-05-25 01:57:19 +0000 | |||
76 | @@ -1290,7 +1290,8 @@ | |||
77 | 1290 | bmp2 = self.factory.makeBranchMergeProposal( | 1290 | bmp2 = self.factory.makeBranchMergeProposal( |
78 | 1291 | date_created=( | 1291 | date_created=( |
79 | 1292 | datetime(year=2008, month=10, day=10, tzinfo=pytz.UTC))) | 1292 | datetime(year=2008, month=10, day=10, tzinfo=pytz.UTC))) |
81 | 1293 | removeSecurityProxy(bmp2.source_branch).explicitly_private = True | 1293 | removeSecurityProxy(bmp2.source_branch).information_type = ( |
82 | 1294 | InformationType.USERDATA) | ||
83 | 1294 | self.assertEqual( | 1295 | self.assertEqual( |
84 | 1295 | [bmp1], latest_proposals_for_each_branch([bmp1, bmp2])) | 1296 | [bmp1], latest_proposals_for_each_branch([bmp1, bmp2])) |
85 | 1296 | 1297 | ||
86 | 1297 | 1298 | ||
87 | === modified file 'lib/lp/code/errors.py' | |||
88 | --- lib/lp/code/errors.py 2012-05-23 22:27:56 +0000 | |||
89 | +++ lib/lp/code/errors.py 2012-05-25 01:57:19 +0000 | |||
90 | @@ -10,6 +10,7 @@ | |||
91 | 10 | 'BadStateTransition', | 10 | 'BadStateTransition', |
92 | 11 | 'BranchCannotBePrivate', | 11 | 'BranchCannotBePrivate', |
93 | 12 | 'BranchCannotBePublic', | 12 | 'BranchCannotBePublic', |
94 | 13 | 'BranchCannotChangeInformationType', | ||
95 | 13 | 'BranchCreationException', | 14 | 'BranchCreationException', |
96 | 14 | 'BranchCreationForbidden', | 15 | 'BranchCreationForbidden', |
97 | 15 | 'BranchCreatorNotMemberOfOwnerTeam', | 16 | 'BranchCreatorNotMemberOfOwnerTeam', |
98 | @@ -155,6 +156,10 @@ | |||
99 | 155 | """The branch cannot be made private.""" | 156 | """The branch cannot be made private.""" |
100 | 156 | 157 | ||
101 | 157 | 158 | ||
102 | 159 | class BranchCannotChangeInformationType(Exception): | ||
103 | 160 | """The information type of this branch cannot be changed.""" | ||
104 | 161 | |||
105 | 162 | |||
106 | 158 | class InvalidBranchException(Exception): | 163 | class InvalidBranchException(Exception): |
107 | 159 | """Base exception for an error resolving a branch for a component. | 164 | """Base exception for an error resolving a branch for a component. |
108 | 160 | 165 | ||
109 | 161 | 166 | ||
110 | === modified file 'lib/lp/code/interfaces/branch.py' | |||
111 | --- lib/lp/code/interfaces/branch.py 2012-05-18 04:14:08 +0000 | |||
112 | +++ lib/lp/code/interfaces/branch.py 2012-05-25 01:57:19 +0000 | |||
113 | @@ -1120,11 +1120,14 @@ | |||
114 | 1120 | :raise: CannotDeleteBranch if the branch cannot be deleted. | 1120 | :raise: CannotDeleteBranch if the branch cannot be deleted. |
115 | 1121 | """ | 1121 | """ |
116 | 1122 | 1122 | ||
119 | 1123 | def transitionToInformationType(information_type, who): | 1123 | def transitionToInformationType(information_type, who, |
120 | 1124 | """Set the information type for this branch. | 1124 | verify_policy=True): |
121 | 1125 | """Set the information type for this branch. | ||
122 | 1125 | 1126 | ||
125 | 1126 | :information_type: The `InformationType` to transition to. | 1127 | :param information_type: The `InformationType` to transition to. |
126 | 1127 | :who: The `IPerson` who is making the change. | 1128 | :param who: The `IPerson` who is making the change. |
127 | 1129 | :param verify_policy: Check if the new information type complies | ||
128 | 1130 | with the `IBranchNamespacePolicy`. | ||
129 | 1128 | """ | 1131 | """ |
130 | 1129 | 1132 | ||
131 | 1130 | 1133 | ||
132 | 1131 | 1134 | ||
133 | === modified file 'lib/lp/code/model/branch.py' | |||
134 | --- lib/lp/code/model/branch.py 2012-05-23 22:27:56 +0000 | |||
135 | +++ lib/lp/code/model/branch.py 2012-05-25 01:57:19 +0000 | |||
136 | @@ -77,6 +77,7 @@ | |||
137 | 77 | AlreadyLatestFormat, | 77 | AlreadyLatestFormat, |
138 | 78 | BranchCannotBePrivate, | 78 | BranchCannotBePrivate, |
139 | 79 | BranchCannotBePublic, | 79 | BranchCannotBePublic, |
140 | 80 | BranchCannotChangeInformationType, | ||
141 | 80 | BranchMergeProposalExists, | 81 | BranchMergeProposalExists, |
142 | 81 | BranchTargetError, | 82 | BranchTargetError, |
143 | 82 | BranchTypeError, | 83 | BranchTypeError, |
144 | @@ -128,7 +129,11 @@ | |||
145 | 128 | ) | 129 | ) |
146 | 129 | from lp.code.model.seriessourcepackagebranch import SeriesSourcePackageBranch | 130 | from lp.code.model.seriessourcepackagebranch import SeriesSourcePackageBranch |
147 | 130 | from lp.codehosting.safe_open import safe_open | 131 | from lp.codehosting.safe_open import safe_open |
149 | 131 | from lp.registry.enums import InformationType | 132 | from lp.registry.enums import ( |
150 | 133 | InformationType, | ||
151 | 134 | PRIVATE_INFORMATION_TYPES, | ||
152 | 135 | PUBLIC_INFORMATION_TYPES, | ||
153 | 136 | ) | ||
154 | 132 | from lp.registry.interfaces.person import ( | 137 | from lp.registry.interfaces.person import ( |
155 | 133 | validate_person, | 138 | validate_person, |
156 | 134 | validate_public_person, | 139 | validate_public_person, |
157 | @@ -187,33 +192,42 @@ | |||
158 | 187 | 192 | ||
159 | 188 | @property | 193 | @property |
160 | 189 | def private(self): | 194 | def private(self): |
162 | 190 | return self.transitively_private | 195 | return self.information_type in PRIVATE_INFORMATION_TYPES |
163 | 191 | 196 | ||
164 | 192 | def setPrivate(self, private, user): | 197 | def setPrivate(self, private, user): |
165 | 193 | """See `IBranch`.""" | 198 | """See `IBranch`.""" |
167 | 194 | if private == self.explicitly_private: | 199 | if private: |
168 | 200 | information_type = InformationType.USERDATA | ||
169 | 201 | else: | ||
170 | 202 | information_type = InformationType.PUBLIC | ||
171 | 203 | return self.transitionToInformationType(information_type, user) | ||
172 | 204 | |||
173 | 205 | def transitionToInformationType(self, information_type, who, | ||
174 | 206 | verify_policy=True): | ||
175 | 207 | """See `IBranch`.""" | ||
176 | 208 | if self.information_type == information_type: | ||
177 | 195 | return | 209 | return |
178 | 210 | if (self.stacked_on | ||
179 | 211 | and self.stacked_on.information_type in PRIVATE_INFORMATION_TYPES | ||
180 | 212 | and information_type in PUBLIC_INFORMATION_TYPES): | ||
181 | 213 | raise BranchCannotChangeInformationType() | ||
182 | 214 | private = information_type in PRIVATE_INFORMATION_TYPES | ||
183 | 196 | # Only check the privacy policy if the user is not special. | 215 | # Only check the privacy policy if the user is not special. |
185 | 197 | if (not user_has_special_branch_access(user)): | 216 | if verify_policy and not user_has_special_branch_access(who): |
186 | 198 | policy = IBranchNamespacePolicy(self.namespace) | 217 | policy = IBranchNamespacePolicy(self.namespace) |
187 | 199 | |||
188 | 200 | if private and not policy.canBranchesBePrivate(): | 218 | if private and not policy.canBranchesBePrivate(): |
189 | 201 | raise BranchCannotBePrivate() | 219 | raise BranchCannotBePrivate() |
190 | 202 | if not private and not policy.canBranchesBePublic(): | 220 | if not private and not policy.canBranchesBePublic(): |
191 | 203 | raise BranchCannotBePublic() | 221 | raise BranchCannotBePublic() |
192 | 222 | self.information_type = information_type | ||
193 | 223 | # Set the legacy values for now. | ||
194 | 204 | self.explicitly_private = private | 224 | self.explicitly_private = private |
195 | 205 | # If this branch is private, then it is also transitively_private | 225 | # If this branch is private, then it is also transitively_private |
196 | 206 | # otherwise we need to reload the value. | 226 | # otherwise we need to reload the value. |
197 | 207 | if private: | 227 | if private: |
198 | 208 | self.transitively_private = True | 228 | self.transitively_private = True |
199 | 209 | self.information_type = InformationType.USERDATA | ||
200 | 210 | else: | 229 | else: |
201 | 211 | self.transitively_private = AutoReload | 230 | self.transitively_private = AutoReload |
202 | 212 | self.information_type = InformationType.PUBLIC | ||
203 | 213 | |||
204 | 214 | def transitionToInformationType(self, information_type, who): | ||
205 | 215 | """See `IBranch`.""" | ||
206 | 216 | self.information_type = information_type | ||
207 | 217 | 231 | ||
208 | 218 | registrant = ForeignKey( | 232 | registrant = ForeignKey( |
209 | 219 | dbName='registrant', foreignKey='Person', | 233 | dbName='registrant', foreignKey='Person', |
210 | @@ -1052,6 +1066,15 @@ | |||
211 | 1052 | self.mirror_status_message = ( | 1066 | self.mirror_status_message = ( |
212 | 1053 | 'Invalid stacked on location: ' + stacked_on_url) | 1067 | 'Invalid stacked on location: ' + stacked_on_url) |
213 | 1054 | self.stacked_on = stacked_on_branch | 1068 | self.stacked_on = stacked_on_branch |
214 | 1069 | # If the branch we are stacking on is not public, and we are, | ||
215 | 1070 | # set our information_type to the stacked on's, since having a | ||
216 | 1071 | # public branch stacked on a private branch does not make sense. | ||
217 | 1072 | if (self.stacked_on | ||
218 | 1073 | and self.stacked_on.information_type in PRIVATE_INFORMATION_TYPES | ||
219 | 1074 | and self.information_type in PUBLIC_INFORMATION_TYPES): | ||
220 | 1075 | self.transitionToInformationType( | ||
221 | 1076 | self.stacked_on.information_type, self.owner, | ||
222 | 1077 | verify_policy=False) | ||
223 | 1055 | if self.branch_type == BranchType.HOSTED: | 1078 | if self.branch_type == BranchType.HOSTED: |
224 | 1056 | self.last_mirrored = UTC_NOW | 1079 | self.last_mirrored = UTC_NOW |
225 | 1057 | else: | 1080 | else: |
226 | @@ -1207,7 +1230,7 @@ | |||
227 | 1207 | This method doesn't check the stacked upon branch. That is handled by | 1230 | This method doesn't check the stacked upon branch. That is handled by |
228 | 1208 | the `visibleByUser` method. | 1231 | the `visibleByUser` method. |
229 | 1209 | """ | 1232 | """ |
231 | 1210 | if not self.explicitly_private: | 1233 | if self.information_type in PUBLIC_INFORMATION_TYPES: |
232 | 1211 | return True | 1234 | return True |
233 | 1212 | if user is None: | 1235 | if user is None: |
234 | 1213 | return False | 1236 | return False |
235 | 1214 | 1237 | ||
236 | === modified file 'lib/lp/code/model/tests/test_branch.py' | |||
237 | --- lib/lp/code/model/tests/test_branch.py 2012-05-23 22:27:56 +0000 | |||
238 | +++ lib/lp/code/model/tests/test_branch.py 2012-05-25 01:57:19 +0000 | |||
239 | @@ -56,6 +56,7 @@ | |||
240 | 56 | AlreadyLatestFormat, | 56 | AlreadyLatestFormat, |
241 | 57 | BranchCannotBePrivate, | 57 | BranchCannotBePrivate, |
242 | 58 | BranchCannotBePublic, | 58 | BranchCannotBePublic, |
243 | 59 | BranchCannotChangeInformationType, | ||
244 | 59 | BranchCreatorNotMemberOfOwnerTeam, | 60 | BranchCreatorNotMemberOfOwnerTeam, |
245 | 60 | BranchCreatorNotOwner, | 61 | BranchCreatorNotOwner, |
246 | 61 | BranchTargetError, | 62 | BranchTargetError, |
247 | @@ -2334,16 +2335,21 @@ | |||
248 | 2334 | def test_public_stacked_on_private_is_private(self): | 2335 | def test_public_stacked_on_private_is_private(self): |
249 | 2335 | # A public branch stacked on a private branch is private. | 2336 | # A public branch stacked on a private branch is private. |
250 | 2336 | stacked_on = self.factory.makeBranch(private=True) | 2337 | stacked_on = self.factory.makeBranch(private=True) |
252 | 2337 | branch = self.factory.makeBranch(stacked_on=stacked_on, private=False) | 2338 | branch = self.factory.makeBranch( |
253 | 2339 | stacked_on=stacked_on, private=False) | ||
254 | 2338 | self.assertTrue(branch.private) | 2340 | self.assertTrue(branch.private) |
255 | 2341 | self.assertEqual( | ||
256 | 2342 | stacked_on.information_type, branch.information_type) | ||
257 | 2339 | self.assertTrue(removeSecurityProxy(branch).transitively_private) | 2343 | self.assertTrue(removeSecurityProxy(branch).transitively_private) |
259 | 2340 | self.assertFalse(branch.explicitly_private) | 2344 | self.assertTrue(branch.explicitly_private) |
260 | 2341 | 2345 | ||
261 | 2342 | def test_private_stacked_on_public_is_private(self): | 2346 | def test_private_stacked_on_public_is_private(self): |
263 | 2343 | # A public branch stacked on a private branch is private. | 2347 | # A private branch stacked on a public branch is private. |
264 | 2344 | stacked_on = self.factory.makeBranch(private=False) | 2348 | stacked_on = self.factory.makeBranch(private=False) |
265 | 2345 | branch = self.factory.makeBranch(stacked_on=stacked_on, private=True) | 2349 | branch = self.factory.makeBranch(stacked_on=stacked_on, private=True) |
266 | 2346 | self.assertTrue(branch.private) | 2350 | self.assertTrue(branch.private) |
267 | 2351 | self.assertNotEqual( | ||
268 | 2352 | stacked_on.information_type, branch.information_type) | ||
269 | 2347 | self.assertTrue(removeSecurityProxy(branch).transitively_private) | 2353 | self.assertTrue(removeSecurityProxy(branch).transitively_private) |
270 | 2348 | self.assertTrue(branch.explicitly_private) | 2354 | self.assertTrue(branch.explicitly_private) |
271 | 2349 | 2355 | ||
272 | @@ -2436,6 +2442,26 @@ | |||
273 | 2436 | branch.setPrivate, | 2442 | branch.setPrivate, |
274 | 2437 | False, branch.owner) | 2443 | False, branch.owner) |
275 | 2438 | 2444 | ||
276 | 2445 | def test_cannot_transition_with_private_stacked_on(self): | ||
277 | 2446 | # If a public branch is stacked on a private branch, it can not | ||
278 | 2447 | # change its information_type to public. | ||
279 | 2448 | stacked_on = self.factory.makeBranch(private=True) | ||
280 | 2449 | branch = self.factory.makeBranch(stacked_on=stacked_on) | ||
281 | 2450 | self.assertRaises( | ||
282 | 2451 | BranchCannotChangeInformationType, | ||
283 | 2452 | branch.transitionToInformationType, InformationType.PUBLIC, | ||
284 | 2453 | branch.owner) | ||
285 | 2454 | |||
286 | 2455 | def test_can_transition_with_public_stacked_on(self): | ||
287 | 2456 | # If a private branch is stacked on a public branch, it can change | ||
288 | 2457 | # its information_type. | ||
289 | 2458 | stacked_on = self.factory.makeBranch() | ||
290 | 2459 | branch = self.factory.makeBranch(stacked_on=stacked_on, private=True) | ||
291 | 2460 | branch.transitionToInformationType( | ||
292 | 2461 | InformationType.UNEMBARGOEDSECURITY, branch.owner) | ||
293 | 2462 | self.assertEqual( | ||
294 | 2463 | InformationType.UNEMBARGOEDSECURITY, branch.information_type) | ||
295 | 2464 | |||
296 | 2439 | 2465 | ||
297 | 2440 | class TestBranchCommitsForDays(TestCaseWithFactory): | 2466 | class TestBranchCommitsForDays(TestCaseWithFactory): |
298 | 2441 | """Tests for `Branch.commitsForDays`.""" | 2467 | """Tests for `Branch.commitsForDays`.""" |
299 | 2442 | 2468 | ||
300 | === modified file 'lib/lp/code/model/tests/test_branchlookup.py' | |||
301 | --- lib/lp/code/model/tests/test_branchlookup.py 2012-01-01 02:58:52 +0000 | |||
302 | +++ lib/lp/code/model/tests/test_branchlookup.py 2012-05-25 01:57:19 +0000 | |||
303 | @@ -147,7 +147,8 @@ | |||
304 | 147 | owner = self.factory.makePerson() | 147 | owner = self.factory.makePerson() |
305 | 148 | private_branch = self.factory.makeAnyBranch( | 148 | private_branch = self.factory.makeAnyBranch( |
306 | 149 | owner=owner, private=True) | 149 | owner=owner, private=True) |
308 | 150 | branch = self.factory.makeAnyBranch(stacked_on=private_branch) | 150 | branch = self.factory.makeAnyBranch( |
309 | 151 | stacked_on=private_branch, owner=owner) | ||
310 | 151 | with person_logged_in(owner): | 152 | with person_logged_in(owner): |
311 | 152 | path = branch_id_alias(branch) | 153 | path = branch_id_alias(branch) |
312 | 153 | result = self.branch_set.getIdAndTrailingPath(path) | 154 | result = self.branch_set.getIdAndTrailingPath(path) |
313 | 154 | 155 | ||
314 | === modified file 'lib/lp/code/model/tests/test_branchmergeproposal.py' | |||
315 | --- lib/lp/code/model/tests/test_branchmergeproposal.py 2012-05-23 22:27:56 +0000 | |||
316 | +++ lib/lp/code/model/tests/test_branchmergeproposal.py 2012-05-25 01:57:19 +0000 | |||
317 | @@ -929,8 +929,9 @@ | |||
318 | 929 | charlie, BranchSubscriptionNotificationLevel.NOEMAIL, None, | 929 | charlie, BranchSubscriptionNotificationLevel.NOEMAIL, None, |
319 | 930 | CodeReviewNotificationLevel.FULL, charlie) | 930 | CodeReviewNotificationLevel.FULL, charlie) |
320 | 931 | # Make both branches private. | 931 | # Make both branches private. |
323 | 932 | removeSecurityProxy(bmp.source_branch).explicitly_private = True | 932 | for branch in (bmp.source_branch, bmp.target_branch): |
324 | 933 | removeSecurityProxy(bmp.target_branch).explicitly_private = True | 933 | removeSecurityProxy(branch).information_type = ( |
325 | 934 | InformationType.USERDATA) | ||
326 | 934 | recipients = bmp.getNotificationRecipients( | 935 | recipients = bmp.getNotificationRecipients( |
327 | 935 | CodeReviewNotificationLevel.FULL) | 936 | CodeReviewNotificationLevel.FULL) |
328 | 936 | self.assertFalse(bob in recipients) | 937 | self.assertFalse(bob in recipients) |
329 | @@ -1505,7 +1506,7 @@ | |||
330 | 1505 | base_branch = self.factory.makeBranch( | 1506 | base_branch = self.factory.makeBranch( |
331 | 1506 | owner=owner, private=True, product=product) | 1507 | owner=owner, private=True, product=product) |
332 | 1507 | source_branch = self.factory.makeBranch( | 1508 | source_branch = self.factory.makeBranch( |
334 | 1508 | stacked_on=base_branch, product=product) | 1509 | stacked_on=base_branch, product=product, owner=owner) |
335 | 1509 | target_branch = self.factory.makeBranch(owner=owner, product=product) | 1510 | target_branch = self.factory.makeBranch(owner=owner, product=product) |
336 | 1510 | target_branch.product.setBranchVisibilityTeamPolicy( | 1511 | target_branch.product.setBranchVisibilityTeamPolicy( |
337 | 1511 | owner, BranchVisibilityRule.PRIVATE) | 1512 | owner, BranchVisibilityRule.PRIVATE) |
338 | 1512 | 1513 | ||
339 | === modified file 'lib/lp/code/model/tests/test_branchvisibility.py' | |||
340 | --- lib/lp/code/model/tests/test_branchvisibility.py 2012-05-23 22:27:56 +0000 | |||
341 | +++ lib/lp/code/model/tests/test_branchvisibility.py 2012-05-25 01:57:19 +0000 | |||
342 | @@ -1,4 +1,4 @@ | |||
344 | 1 | # Copyright 2011 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2011-2012 Canonical Ltd. This software is licensed under the |
345 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
346 | 3 | 3 | ||
347 | 4 | """Tests for visibility of branches. | 4 | """Tests for visibility of branches. |
348 | @@ -134,14 +134,11 @@ | |||
349 | 134 | private_owner = self.factory.makePerson() | 134 | private_owner = self.factory.makePerson() |
350 | 135 | test_branches = [] | 135 | test_branches = [] |
351 | 136 | for x in range(5): | 136 | for x in range(5): |
356 | 137 | # We want the first 3 public and the last 3 private | 137 | # We want the first 3 public and the last 3 private. |
357 | 138 | branch = self.factory.makeBranch(name='branch_%s' % x) | 138 | branch = self.factory.makeBranch(private=x > 2) |
354 | 139 | # The 3rd, 4th and 5th will be explicitly private. | ||
355 | 140 | branch.explicitly_private = x > 2 | ||
358 | 141 | test_branches.append(branch) | 139 | test_branches.append(branch) |
359 | 142 | test_branches.append( | 140 | test_branches.append( |
362 | 143 | self.factory.makeBranch( | 141 | self.factory.makeBranch(private=True, owner=private_owner)) |
361 | 144 | name='branch_5', private=True, owner=private_owner)) | ||
363 | 145 | 142 | ||
364 | 146 | # Anonymous users see just the public branches. | 143 | # Anonymous users see just the public branches. |
365 | 147 | branch_info = [(branch, branch.private) | 144 | branch_info = [(branch, branch.private) |
366 | 148 | 145 | ||
367 | === modified file 'lib/lp/code/model/tests/test_sourcepackagerecipe.py' | |||
368 | --- lib/lp/code/model/tests/test_sourcepackagerecipe.py 2012-02-28 11:14:44 +0000 | |||
369 | +++ lib/lp/code/model/tests/test_sourcepackagerecipe.py 2012-05-25 01:57:19 +0000 | |||
370 | @@ -50,6 +50,7 @@ | |||
371 | 50 | ) | 50 | ) |
372 | 51 | from lp.code.model.sourcepackagerecipedata import SourcePackageRecipeData | 51 | from lp.code.model.sourcepackagerecipedata import SourcePackageRecipeData |
373 | 52 | from lp.code.tests.helpers import recipe_parser_newest_version | 52 | from lp.code.tests.helpers import recipe_parser_newest_version |
374 | 53 | from lp.registry.enums import InformationType | ||
375 | 53 | from lp.registry.interfaces.pocket import PackagePublishingPocket | 54 | from lp.registry.interfaces.pocket import PackagePublishingPocket |
376 | 54 | from lp.services.database.bulk import load_referencing | 55 | from lp.services.database.bulk import load_referencing |
377 | 55 | from lp.services.database.constants import UTC_NOW | 56 | from lp.services.database.constants import UTC_NOW |
378 | @@ -529,7 +530,8 @@ | |||
379 | 529 | with person_logged_in(owner): | 530 | with person_logged_in(owner): |
380 | 530 | recipe = self.factory.makeSourcePackageRecipe(branches=[branch]) | 531 | recipe = self.factory.makeSourcePackageRecipe(branches=[branch]) |
381 | 531 | self.assertTrue(check_permission('launchpad.View', recipe)) | 532 | self.assertTrue(check_permission('launchpad.View', recipe)) |
383 | 532 | removeSecurityProxy(branch).explicitly_private = True | 533 | removeSecurityProxy(branch).information_type = ( |
384 | 534 | InformationType.USERDATA) | ||
385 | 533 | with person_logged_in(self.factory.makePerson()): | 535 | with person_logged_in(self.factory.makePerson()): |
386 | 534 | self.assertFalse(check_permission('launchpad.View', recipe)) | 536 | self.assertFalse(check_permission('launchpad.View', recipe)) |
387 | 535 | self.assertFalse(check_permission('launchpad.View', recipe)) | 537 | self.assertFalse(check_permission('launchpad.View', recipe)) |
388 | 536 | 538 | ||
389 | === modified file 'lib/lp/code/model/tests/test_sourcepackagerecipebuild.py' | |||
390 | --- lib/lp/code/model/tests/test_sourcepackagerecipebuild.py 2012-04-24 06:44:30 +0000 | |||
391 | +++ lib/lp/code/model/tests/test_sourcepackagerecipebuild.py 2012-05-25 01:57:19 +0000 | |||
392 | @@ -1,4 +1,4 @@ | |||
394 | 1 | # Copyright 2010-2011 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2010-2012 Canonical Ltd. This software is licensed under the |
395 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
396 | 3 | 3 | ||
397 | 4 | """Tests for source package builds.""" | 4 | """Tests for source package builds.""" |
398 | @@ -38,6 +38,7 @@ | |||
399 | 38 | SourcePackageRecipeBuildMailer, | 38 | SourcePackageRecipeBuildMailer, |
400 | 39 | ) | 39 | ) |
401 | 40 | from lp.code.model.sourcepackagerecipebuild import SourcePackageRecipeBuild | 40 | from lp.code.model.sourcepackagerecipebuild import SourcePackageRecipeBuild |
402 | 41 | from lp.registry.enums import InformationType | ||
403 | 41 | from lp.registry.interfaces.pocket import PackagePublishingPocket | 42 | from lp.registry.interfaces.pocket import PackagePublishingPocket |
404 | 42 | from lp.registry.interfaces.series import SeriesStatus | 43 | from lp.registry.interfaces.series import SeriesStatus |
405 | 43 | from lp.services.database.lpstorm import IStore | 44 | from lp.services.database.lpstorm import IStore |
406 | @@ -176,7 +177,8 @@ | |||
407 | 176 | job = build.makeJob() | 177 | job = build.makeJob() |
408 | 177 | self.assertTrue(check_permission('launchpad.View', build)) | 178 | self.assertTrue(check_permission('launchpad.View', build)) |
409 | 178 | self.assertTrue(check_permission('launchpad.View', job)) | 179 | self.assertTrue(check_permission('launchpad.View', job)) |
411 | 179 | removeSecurityProxy(branch).explicitly_private = True | 180 | removeSecurityProxy(branch).information_type = ( |
412 | 181 | InformationType.USERDATA) | ||
413 | 180 | with person_logged_in(self.factory.makePerson()): | 182 | with person_logged_in(self.factory.makePerson()): |
414 | 181 | self.assertFalse(check_permission('launchpad.View', build)) | 183 | self.assertFalse(check_permission('launchpad.View', build)) |
415 | 182 | self.assertFalse(check_permission('launchpad.View', job)) | 184 | self.assertFalse(check_permission('launchpad.View', job)) |
416 | 183 | 185 | ||
417 | === modified file 'lib/lp/code/stories/branches/xx-branch-edit-privacy.txt' | |||
418 | --- lib/lp/code/stories/branches/xx-branch-edit-privacy.txt 2012-01-15 13:32:27 +0000 | |||
419 | +++ lib/lp/code/stories/branches/xx-branch-edit-privacy.txt 2012-05-25 01:57:19 +0000 | |||
420 | @@ -129,36 +129,3 @@ | |||
421 | 129 | Traceback (most recent call last): | 129 | Traceback (most recent call last): |
422 | 130 | ... | 130 | ... |
423 | 131 | LookupError: label 'Keep branch confidential' | 131 | LookupError: label 'Keep branch confidential' |
424 | 132 | |||
425 | 133 | |||
426 | 134 | Branches stacked on private branches | ||
427 | 135 | ------------------------------------ | ||
428 | 136 | |||
429 | 137 | A public branch is private if it is stacked on a private branch. When the | ||
430 | 138 | branch is edited, it is shown as private but the checkbox widget is disabled | ||
431 | 139 | and the title and hint text is updated to inform the user. | ||
432 | 140 | |||
433 | 141 | >>> login('admin@canonical.com') | ||
434 | 142 | >>> stacked_on_branch = factory.makeAnyBranch(private=True) | ||
435 | 143 | >>> stacked_branch = factory.makeAnyBranch(stacked_on=stacked_on_branch) | ||
436 | 144 | >>> url = canonical_url(stacked_branch) | ||
437 | 145 | >>> logout() | ||
438 | 146 | |||
439 | 147 | >>> admin_browser.open(url) | ||
440 | 148 | >>> admin_browser.getLink('Change branch details').click() | ||
441 | 149 | >>> privacy_checkbox = admin_browser.getControl('Branch is confidential') | ||
442 | 150 | >>> print privacy_checkbox.selected | ||
443 | 151 | True | ||
444 | 152 | >>> print privacy_checkbox.disabled | ||
445 | 153 | True | ||
446 | 154 | >>> ('branch is confidential because it is stacked on a private branch' | ||
447 | 155 | ... in admin_browser.contents) | ||
448 | 156 | True | ||
449 | 157 | |||
450 | 158 | If the branch is edited and saved, there is no user message displayed since | ||
451 | 159 | the transitive privacy status hasn't changed. | ||
452 | 160 | |||
453 | 161 | >>> admin_browser.getControl('Description').value = "New changes" | ||
454 | 162 | >>> admin_browser.getControl('Change Branch').click() | ||
455 | 163 | >>> print_feedback_messages(browser.contents) | ||
456 | 164 | ... | ||
457 | 165 | 132 | ||
458 | === modified file 'lib/lp/code/stories/branches/xx-branch-index.txt' | |||
459 | --- lib/lp/code/stories/branches/xx-branch-index.txt 2012-02-22 21:51:33 +0000 | |||
460 | +++ lib/lp/code/stories/branches/xx-branch-index.txt 2012-05-25 01:57:19 +0000 | |||
461 | @@ -409,21 +409,6 @@ | |||
462 | 409 | >>> print extract_text(find_tag_by_id(content, 'privacy')) | 409 | >>> print extract_text(find_tag_by_id(content, 'privacy')) |
463 | 410 | This branch is public | 410 | This branch is public |
464 | 411 | 411 | ||
465 | 412 | We mark the stacked-on branch as private: | ||
466 | 413 | |||
467 | 414 | >>> admin_browser.open(stacked_on_url) | ||
468 | 415 | >>> admin_browser.getLink('Change branch details').click() | ||
469 | 416 | >>> admin_browser.getControl('Keep branch confidential').selected = True | ||
470 | 417 | >>> admin_browser.getControl('Change Branch').click() | ||
471 | 418 | |||
472 | 419 | Now the stacked branch is private: | ||
473 | 420 | |||
474 | 421 | >>> admin_browser.open(url) | ||
475 | 422 | >>> content = find_tag_by_id(admin_browser.contents, 'document') | ||
476 | 423 | >>> print extract_text(find_tag_by_id(content, 'privacy')) | ||
477 | 424 | This branch is private because it is stacked on a private branch. | ||
478 | 425 | |||
479 | 426 | |||
480 | 427 | Navigation Context | 412 | Navigation Context |
481 | 428 | .................. | 413 | .................. |
482 | 429 | 414 | ||
483 | 430 | 415 | ||
484 | === modified file 'lib/lp/code/xmlrpc/tests/test_branch.py' | |||
485 | --- lib/lp/code/xmlrpc/tests/test_branch.py 2012-05-23 22:27:56 +0000 | |||
486 | +++ lib/lp/code/xmlrpc/tests/test_branch.py 2012-05-25 01:57:19 +0000 | |||
487 | @@ -1,4 +1,4 @@ | |||
489 | 1 | # Copyright 2009-2011 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2009-2012 Canonical Ltd. This software is licensed under the |
490 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
491 | 3 | 3 | ||
492 | 4 | """Unit tests for the public codehosting API.""" | 4 | """Unit tests for the public codehosting API.""" |
493 | @@ -16,6 +16,7 @@ | |||
494 | 16 | from lp.code.interfaces.codehosting import BRANCH_ALIAS_PREFIX | 16 | from lp.code.interfaces.codehosting import BRANCH_ALIAS_PREFIX |
495 | 17 | from lp.code.interfaces.linkedbranch import ICanHasLinkedBranch | 17 | from lp.code.interfaces.linkedbranch import ICanHasLinkedBranch |
496 | 18 | from lp.code.xmlrpc.branch import PublicCodehostingAPI | 18 | from lp.code.xmlrpc.branch import PublicCodehostingAPI |
497 | 19 | from lp.registry.enums import InformationType | ||
498 | 19 | from lp.services.xmlrpc import LaunchpadFault | 20 | from lp.services.xmlrpc import LaunchpadFault |
499 | 20 | from lp.testing import ( | 21 | from lp.testing import ( |
500 | 21 | person_logged_in, | 22 | person_logged_in, |
501 | @@ -323,7 +324,8 @@ | |||
502 | 323 | def test_private_branch_as_development_focus(self): | 324 | def test_private_branch_as_development_focus(self): |
503 | 324 | # We resolve private linked branches using the writable alias. | 325 | # We resolve private linked branches using the writable alias. |
504 | 325 | product, trunk = self.makeProdutWithTrunk() | 326 | product, trunk = self.makeProdutWithTrunk() |
506 | 326 | removeSecurityProxy(trunk).explicitly_private = True | 327 | removeSecurityProxy(trunk).information_type = ( |
507 | 328 | InformationType.USERDATA) | ||
508 | 327 | self.assertOnlyWritableResolves(product.name) | 329 | self.assertOnlyWritableResolves(product.name) |
509 | 328 | 330 | ||
510 | 329 | def test_private_branch_as_user(self): | 331 | def test_private_branch_as_user(self): |
511 | 330 | 332 | ||
512 | === modified file 'lib/lp/registry/stories/product/xx-product-development-focus.txt' | |||
513 | --- lib/lp/registry/stories/product/xx-product-development-focus.txt 2012-01-15 13:32:27 +0000 | |||
514 | +++ lib/lp/registry/stories/product/xx-product-development-focus.txt 2012-05-25 01:57:19 +0000 | |||
515 | @@ -14,7 +14,9 @@ | |||
516 | 14 | >>> eric = factory.makePerson(name='eric', email='eric@example.com') | 14 | >>> eric = factory.makePerson(name='eric', email='eric@example.com') |
517 | 15 | >>> fooix = factory.makeProduct(name='fooix', owner=eric) | 15 | >>> fooix = factory.makeProduct(name='fooix', owner=eric) |
518 | 16 | >>> branch = factory.makeBranch(owner=eric, product=fooix, name='trunk') | 16 | >>> branch = factory.makeBranch(owner=eric, product=fooix, name='trunk') |
520 | 17 | >>> # Make revisions for the branch so it has a codebrowse link. | 17 | |
521 | 18 | Make revisions for the branch so it has a codebrowse link. | ||
522 | 19 | |||
523 | 18 | >>> factory.makeRevisionsForBranch(branch) | 20 | >>> factory.makeRevisionsForBranch(branch) |
524 | 19 | >>> logout() | 21 | >>> logout() |
525 | 20 | 22 | ||
526 | @@ -145,7 +147,9 @@ | |||
527 | 145 | 147 | ||
528 | 146 | >>> login('admin@canonical.com') | 148 | >>> login('admin@canonical.com') |
529 | 147 | >>> from zope.security.proxy import removeSecurityProxy | 149 | >>> from zope.security.proxy import removeSecurityProxy |
531 | 148 | >>> removeSecurityProxy(branch).explicitly_private = True | 150 | >>> from lp.registry.enums import InformationType |
532 | 151 | >>> removeSecurityProxy(branch).information_type = ( | ||
533 | 152 | ... InformationType.USERDATA) | ||
534 | 149 | >>> logout() | 153 | >>> logout() |
535 | 150 | 154 | ||
536 | 151 | >>> anon_browser.open('http://launchpad.dev/fooix') | 155 | >>> anon_browser.open('http://launchpad.dev/fooix') |
537 | 152 | 156 | ||
538 | === modified file 'lib/lp/testing/factory.py' | |||
539 | --- lib/lp/testing/factory.py 2012-05-23 22:27:56 +0000 | |||
540 | +++ lib/lp/testing/factory.py 2012-05-25 01:57:19 +0000 | |||
541 | @@ -1072,8 +1072,8 @@ | |||
542 | 1072 | 1072 | ||
543 | 1073 | def makeBranch(self, branch_type=None, owner=None, | 1073 | def makeBranch(self, branch_type=None, owner=None, |
544 | 1074 | name=None, product=_DEFAULT, url=_DEFAULT, registrant=None, | 1074 | name=None, product=_DEFAULT, url=_DEFAULT, registrant=None, |
547 | 1075 | private=False, stacked_on=None, sourcepackage=None, | 1075 | private=None, information_type=None, stacked_on=None, |
548 | 1076 | reviewer=None, **optional_branch_args): | 1076 | sourcepackage=None, reviewer=None, **optional_branch_args): |
549 | 1077 | """Create and return a new, arbitrary Branch of the given type. | 1077 | """Create and return a new, arbitrary Branch of the given type. |
550 | 1078 | 1078 | ||
551 | 1079 | Any parameters for `IBranchNamespace.createBranch` can be specified to | 1079 | Any parameters for `IBranchNamespace.createBranch` can be specified to |
552 | @@ -1119,11 +1119,19 @@ | |||
553 | 1119 | branch = namespace.createBranch( | 1119 | branch = namespace.createBranch( |
554 | 1120 | branch_type=branch_type, name=name, registrant=registrant, | 1120 | branch_type=branch_type, name=name, registrant=registrant, |
555 | 1121 | url=url, **optional_branch_args) | 1121 | url=url, **optional_branch_args) |
559 | 1122 | if private: | 1122 | assert information_type is None or private is None, ( |
560 | 1123 | removeSecurityProxy(branch).explicitly_private = True | 1123 | "Can not specify both information_type and private") |
561 | 1124 | removeSecurityProxy(branch).transitively_private = True | 1124 | if private is not None: |
562 | 1125 | information_type = ( | ||
563 | 1126 | InformationType.USERDATA if private else | ||
564 | 1127 | InformationType.PUBLIC) | ||
565 | 1128 | if information_type is not None: | ||
566 | 1129 | removeSecurityProxy(branch).transitionToInformationType( | ||
567 | 1130 | information_type, registrant, verify_policy=False) | ||
568 | 1125 | if stacked_on is not None: | 1131 | if stacked_on is not None: |
570 | 1126 | removeSecurityProxy(branch).stacked_on = stacked_on | 1132 | removeSecurityProxy(branch).branchChanged( |
571 | 1133 | removeSecurityProxy(stacked_on).unique_name, 'rev1', None, | ||
572 | 1134 | None, None) | ||
573 | 1127 | if reviewer is not None: | 1135 | if reviewer is not None: |
574 | 1128 | removeSecurityProxy(branch).reviewer = reviewer | 1136 | removeSecurityProxy(branch).reviewer = reviewer |
575 | 1129 | return branch | 1137 | return branch |
576 | 1130 | 1138 | ||
577 | === modified file 'lib/lp/translations/tests/test_translationtemplatesbuildjob.py' | |||
578 | --- lib/lp/translations/tests/test_translationtemplatesbuildjob.py 2012-01-01 02:58:52 +0000 | |||
579 | +++ lib/lp/translations/tests/test_translationtemplatesbuildjob.py 2012-05-25 01:57:19 +0000 | |||
580 | @@ -1,4 +1,4 @@ | |||
582 | 1 | # Copyright 2010 Canonical Ltd. This software is licensed under the | 1 | # Copyright 2010-2012 Canonical Ltd. This software is licensed under the |
583 | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). | 2 | # GNU Affero General Public License version 3 (see the file LICENSE). |
584 | 3 | 3 | ||
585 | 4 | __metaclass__ = type | 4 | __metaclass__ = type |
586 | @@ -17,6 +17,7 @@ | |||
587 | 17 | from lp.code.model.branchjob import BranchJob | 17 | from lp.code.model.branchjob import BranchJob |
588 | 18 | from lp.code.model.directbranchcommit import DirectBranchCommit | 18 | from lp.code.model.directbranchcommit import DirectBranchCommit |
589 | 19 | from lp.codehosting.scanner import events | 19 | from lp.codehosting.scanner import events |
590 | 20 | from lp.registry.enums import InformationType | ||
591 | 20 | from lp.services.job.model.job import Job | 21 | from lp.services.job.model.job import Job |
592 | 21 | from lp.services.webapp.interfaces import ( | 22 | from lp.services.webapp.interfaces import ( |
593 | 22 | DEFAULT_FLAVOR, | 23 | DEFAULT_FLAVOR, |
594 | @@ -249,7 +250,8 @@ | |||
595 | 249 | def test_private_branch(self): | 250 | def test_private_branch(self): |
596 | 250 | # We don't generate templates for private branches. | 251 | # We don't generate templates for private branches. |
597 | 251 | branch = self._makeTranslationBranch(fake_pottery_compatible=True) | 252 | branch = self._makeTranslationBranch(fake_pottery_compatible=True) |
599 | 252 | removeSecurityProxy(branch).explicitly_private = True | 253 | removeSecurityProxy(branch).information_type = ( |
600 | 254 | InformationType.USERDATA) | ||
601 | 253 | self.assertFalse(self.jobsource.generatesTemplates(branch)) | 255 | self.assertFalse(self.jobsource.generatesTemplates(branch)) |
602 | 254 | 256 | ||
603 | 255 | def test_scheduleTranslationTemplatesBuild_subscribed(self): | 257 | def test_scheduleTranslationTemplatesBuild_subscribed(self): |