Merge lp:~adeuring/launchpad/security-guarded-test-object-factory-1 into lp:launchpad
Status: | Merged |
---|---|
Approved by: | Jeroen T. Vermeulen |
Approved revision: | no longer in the source branch. |
Merged at revision: | 11208 |
Proposed branch: | lp:~adeuring/launchpad/security-guarded-test-object-factory-1 |
Merge into: | lp:launchpad |
Diff against target: |
852 lines (+251/-48) 20 files modified
lib/lp/code/browser/tests/test_branchlisting.py (+4/-2) lib/lp/code/browser/tests/test_sourcepackagerecipe.py (+12/-5) lib/lp/code/browser/tests/test_sourcepackagerecipebuild.py (+4/-1) lib/lp/code/model/tests/test_branch.py (+4/-1) lib/lp/code/model/tests/test_linkedbranch.py (+7/-2) lib/lp/code/model/tests/test_sourcepackagerecipebuild.py (+5/-2) lib/lp/registry/browser/tests/distroseries-views.txt (+1/-1) lib/lp/registry/browser/tests/milestone-views.txt (+5/-1) lib/lp/registry/browser/tests/productseries-views.txt (+6/-2) lib/lp/registry/stories/webservice/xx-project-registry.txt (+4/-2) lib/lp/registry/tests/test_distroseries.py (+15/-6) lib/lp/registry/tests/test_sourcepackage.py (+9/-2) lib/lp/soyuz/browser/tests/test_distrosourcepackagerelease.py (+7/-1) lib/lp/soyuz/browser/tests/test_sourcepackagerelease.py (+11/-5) lib/lp/soyuz/tests/test_publishing.py (+9/-3) lib/lp/testing/factory.py (+82/-7) lib/lp/testing/tests/test_factory.py (+50/-0) lib/lp/translations/browser/tests/test_breadcrumbs.py (+3/-1) lib/lp/translations/doc/translations-export-to-branch.txt (+5/-1) lib/lp/translations/stories/buildfarm/xx-build-summary.txt (+8/-3) |
To merge this branch: | bzr merge lp:~adeuring/launchpad/security-guarded-test-object-factory-1 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jeroen T. Vermeulen (community) | code | Approve | |
Review via email: mp+30497@code.launchpad.net |
Description of the change
While working together with Brian on another branch during the LP epic last week, I was bitten by the fact that we have still a number of methods in LaunchpadObject
Some time ago, Gavin noticed the same problem, IIRC for makePerson(); he also filed a bug that other methods still returned unproxied objects, and Salgado finally fixed that bug.
However, new methods obviously returning unproxied objects creeped into LaunchpadObject
The implementation is quite simple: I renamed LaunchpadObject
We have at present ca 20 methods which return, at least sometimes, unproxied objects. Fixing all these methods in one branch would result in a huge diff, so I fixed only two methods in this branch, makeDistroRelease() and makeProductSeri
My plan is to let guarded_method() raise an exception if it detects an unproxied object, once all existing factory methods return properly proxied objects. For now, it just print a warning to stderr.
The largest part of the diff is test fixes. I took the simple route: Just to remove the security proxy so that the affected tests pass again. I did not bother to check if this is reasonable in a given test -- doing so would simply have needed far too much time. Instead, I added a function remove_
Pre-/mid-imp discussions with Jeroen and Gary.
affected tests: Many, see the diff.
I also removed some lint in the files I touched, but some messages remain:
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
./lib/lp/
83: want exceeds 78 characters.
./lib/lp/
570: source exceeds 78 characters.
1254: 'IRepresentatio
./lib/lp/
119: E302 expected 2 blank lines, found 1
./lib/lp/
27: E501 line too long (81 characters)
37: E501 line too long (86 characters)
45: E501 line too long (81 characters)
56: E501 line too long (86 characters)
64: E501 line too long (81 characters)
72: E501 line too long (82 characters)
81: E501 line too long (82 characters)
88: E501 line too long (81 characters)
138: E301 expected 1 blank line, found 0
152: E501 line too long (85 characters)
27: Line exceeds 78 characters.
37: Line exceeds 78 characters.
45: Line exceeds 78 characters.
56: Line exceeds 78 characters.
64: Line exceeds 78 characters.
72: Line exceeds 78 characters.
81: Line exceeds 78 characters.
88: Line exceeds 78 characters.
116: Line exceeds 78 characters.
133: Line exceeds 78 characters.
152: Line exceeds 78 characters.
./lib/lp/
0: narrative uses a moin header.
15: want exceeds 78 characters.
273: narrative uses a moin header.
301: narrative uses a moin header.
242: Could not compile:
./lib/lp/
0: narrative uses a moin header.
5: narrative uses a moin header.
64: narrative uses a moin header.
Thanks for doing this. We discussed this over IRL chat and came up with many little improvements: chiefly renaming _LaunchpadObjec tFactory to BareLaunchpadOb jectFactory, moving some code out of a nested function, fixing some corner cases, and adding a test for the proxy-checking function since it turned out to be a lot less trivial than originally thought.
This is often the case when engineers say a change will be trivial.
Jeroen