124
124
self.factory.makeBugAttachment(bug=task.bug)
125
125
self.assertThat(task, browses_under_limit)
127
def test_rendered_query_counts_reduced_with_branches(self):
129
owner = f.makePerson()
130
ds = f.makeDistroSeries()
131
sourcepackagenames = [
132
f.makeSourcePackageName('testsourcepackagename%d' % i)
136
sourcepackagename=name, distroseries=ds, publish=True)
137
for name in sourcepackagenames]
140
for sp in sourcepackages:
141
bugtask = f.makeBugTask(bug=bug, owner=owner, target=sp)
142
bugtasks.append(bugtask)
144
url = canonical_url(task)
145
recorder = QueryCollector()
147
self.addCleanup(recorder.unregister)
148
self.invalidate_caches(task)
149
self.getUserBrowser(url, owner)
150
# At least 20 of these should be removed.
151
self.assertThat(recorder, HasQueryCount(LessThan(100)))
152
count_with_no_branches = recorder.count
153
self.invalidate_caches(task)
154
with person_logged_in(owner):
155
for sp in sourcepackages:
156
target_branch = f.makePackageBranch(
157
sourcepackage=sp, owner=owner)
158
source_branch = f.makeBranchTargetBranch(
159
target_branch.target, owner=owner)
160
bug.linkBranch(source_branch, owner)
161
f.makeBranchMergeProposal(
162
target_branch=target_branch,
164
source_branch=source_branch)
165
self.getUserBrowser(url, owner)
166
# Ideally this should be much fewer, but this tries to keep a win of
167
# removing more than half of these.
168
self.assertThat(recorder, HasQueryCount(
169
LessThan(count_with_no_branches + 45),
127
172
def test_interesting_activity(self):
128
173
# The interesting_activity property returns a tuple of interesting
129
174
# `BugActivityItem`s.