Merge lp:~cjwatson/launchpad/testfix-import-warnings into lp:launchpad

Proposed by Colin Watson
Status: Merged
Merged at revision: 17754
Proposed branch: lp:~cjwatson/launchpad/testfix-import-warnings
Merge into: lp:launchpad
Diff against target: 43 lines (+5/-3)
2 files modified
lib/lp/soyuz/browser/archivesubscription.py (+2/-2)
lib/lp/soyuz/tests/test_archive_subscriptions.py (+3/-1)
To merge this branch: bzr merge lp:~cjwatson/launchpad/testfix-import-warnings
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+272228@code.launchpad.net

Commit message

Listify result of getBySubscriberWithActiveToken to avoid doing the eager load twice.

Description of the change

Listify result of getBySubscriberWithActiveToken to avoid doing the eager load twice.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/soyuz/browser/archivesubscription.py'
2--- lib/lp/soyuz/browser/archivesubscription.py 2015-09-23 15:43:43 +0000
3+++ lib/lp/soyuz/browser/archivesubscription.py 2015-09-24 11:39:50 +0000
4@@ -320,8 +320,8 @@
5 cleaner.
6 """
7 subscriber_set = getUtility(IArchiveSubscriberSet)
8- subs_with_tokens = subscriber_set.getBySubscriberWithActiveToken(
9- self.context)
10+ subs_with_tokens = list(
11+ subscriber_set.getBySubscriberWithActiveToken(self.context))
12
13 # ArchiveSubscriber.archive is preloaded.
14 archives = [subscriber.archive for subscriber, _ in subs_with_tokens]
15
16=== modified file 'lib/lp/soyuz/tests/test_archive_subscriptions.py'
17--- lib/lp/soyuz/tests/test_archive_subscriptions.py 2015-01-07 11:26:05 +0000
18+++ lib/lp/soyuz/tests/test_archive_subscriptions.py 2015-09-24 11:39:50 +0000
19@@ -3,6 +3,7 @@
20
21 """Test Archive features."""
22
23+from fixtures import FakeLogger
24 from storm.store import Store
25 from testtools.matchers import Equals
26 from zope.security.interfaces import Unauthorized
27@@ -161,6 +162,7 @@
28 self.assertIsNotNone(find_tag_by_id(content, 'ppa-install'))
29
30 def test_unauthorized_subscriber_for_plus_packages(self):
31+ self.useFixture(FakeLogger())
32 with person_logged_in(self.owner):
33 self.archive.newSubscription(
34 self.subscriber, registrant=self.archive.owner)
35@@ -191,7 +193,7 @@
36 view = create_initialized_view(
37 subscriber, '+archivesubscriptions', principal=subscriber)
38 view.render()
39- self.assertThat(recorder, HasQueryCount(Equals(13)))
40+ self.assertThat(recorder, HasQueryCount(Equals(12)))
41
42 def test_getArchiveSubscriptions(self):
43 # Anyone with 'View' permission on a given person is able to