~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/bugs/browser/tests/test_expose.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-09-22 21:02:33 UTC
  • mfrom: (14006.2.5 trivial)
  • Revision ID: launchpad@pqm.canonical.com-20110922210233-j0gidd1az9bh992o
[r=allenap,
        rvb][bug=856048][no-qa] Merge SQLLogger and StormStatementRecorder.

Show diffs side-by-side

added added

removed removed

Lines of Context:
124
124
        # the team.  (If the team has a preferredemail, muting is not
125
125
        # possible).
126
126
        context = self.factory.makeProduct(owner=self.user)
127
 
        team1 = self.factory.makeTeam(name='team-1', owner=self.user)
 
127
        self.factory.makeTeam(name='team-1', owner=self.user)
128
128
        team2 = self.factory.makeTeam(name='team-2', owner=self.user)
129
129
        self.factory.makeEmail('foo@example.net',
130
130
                               team2,
186
186
                absoluteURL=fake_absoluteURL)
187
187
        statements_for_admininstrated_teams = [
188
188
            statement for statement in recorder.statements
189
 
            if statement.startswith("'SELECT *")]
 
189
            if statement.startswith("SELECT *")]
190
190
        self.assertEqual(1, len(statements_for_admininstrated_teams))
191
191
 
192
192
        # Calling the function a second time does not require an
197
197
                absoluteURL=fake_absoluteURL)
198
198
        statements_for_admininstrated_teams = [
199
199
            statement for statement in recorder.statements
200
 
            if statement.startswith("'SELECT *")]
 
200
            if statement.startswith("SELECT *")]
201
201
        self.assertEqual(0, len(statements_for_admininstrated_teams))
202
202
 
203
203
    def test_teams_owned_but_not_joined_are_not_included(self):
313
313
            sub = target.addBugSubscription(team, team.teamowner)
314
314
        expose_user_subscriptions_to_js(user, [sub], request)
315
315
        info = IJSONRequestCache(request).objects['subscription_info']
316
 
        self.assertEqual(len(info), 1) # One target.
 
316
        self.assertEqual(len(info), 1)  # One target.
317
317
        target_info = info[0]
318
318
        self.assertEqual(target_info['target_title'], target.title)
319
319
        self.assertEqual(
320
320
            target_info['target_url'], canonical_url(
321
321
                target, rootsite='mainsite'))
322
 
        self.assertEqual(len(target_info['filters']), 1) # One filter.
 
322
        self.assertEqual(len(target_info['filters']), 1)  # One filter.
323
323
        filter_info = target_info['filters'][0]
324
324
        self.assertEqual(filter_info['filter'], sub.bug_filters[0])
325
325
        self.assertTrue(filter_info['subscriber_is_team'])
409
409
            expose_user_subscriptions_to_js(user, [sub], request)
410
410
        statements_for_admininstrated_teams = [
411
411
            statement for statement in recorder.statements
412
 
            if statement.startswith("'SELECT *")]
 
412
            if statement.startswith("SELECT *")]
413
413
        self.assertEqual(1, len(statements_for_admininstrated_teams))
414
414
 
415
415
        # Calling the function a second time does not require an
419
419
                expose_user_subscriptions_to_js(user, [sub], request)
420
420
        statements_for_admininstrated_teams = [
421
421
            statement for statement in recorder.statements
422
 
            if statement.startswith("'SELECT *")]
 
422
            if statement.startswith("SELECT *")]
423
423
        self.assertEqual(0, len(statements_for_admininstrated_teams))