Merge lp:~stevenk/launchpad/information_type-branch-privacy-trigger into lp:launchpad

Proposed by Steve Kowalik on 2012-05-10
Status: Merged
Approved by: Steve Kowalik on 2012-05-10
Approved revision: no longer in the source branch.
Merged at revision: 15225
Proposed branch: lp:~stevenk/launchpad/information_type-branch-privacy-trigger
Merge into: lp:launchpad
Diff against target: 40 lines (+10/-4)
1 file modified
lib/lp/code/model/tests/test_branch_privacy_triggers.py (+10/-4)
To merge this branch: bzr merge lp:~stevenk/launchpad/information_type-branch-privacy-trigger
Reviewer Review Type Date Requested Status
Ian Booth (community) 2012-05-10 Approve on 2012-05-10
Review via email: mp+105291@code.launchpad.net

Commit Message

Fix test_branch_privacy_triggers to also set information_type.

Description of the Change

Due to the march forward adding information_type to branch, and the fact that it is populated everywhere, we are preparing to set the column to NOT NULL. This branch fixes test failures due to that by making sure that information_type is set.

To post a comment you must log in.
Ian Booth (wallyworld) wrote :

Look good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/code/model/tests/test_branch_privacy_triggers.py'
2--- lib/lp/code/model/tests/test_branch_privacy_triggers.py 2012-02-21 22:46:28 +0000
3+++ lib/lp/code/model/tests/test_branch_privacy_triggers.py 2012-05-10 02:40:23 +0000
4@@ -8,6 +8,7 @@
5
6 import unittest
7
8+from lp.registry.enums import InformationType
9 from lp.services.database.sqlbase import cursor
10 from lp.testing.dbuser import switch_dbuser
11 from lp.testing.layers import LaunchpadZopelessLayer
12@@ -29,7 +30,11 @@
13 # 6 stacked on 1 at insert time
14 cur = cursor()
15 for x in range(7):
16- is_private = 'True' if x == 3 else 'False'
17+ is_private = 'False'
18+ information_type = InformationType.PUBLIC.value
19+ if x == 3:
20+ is_private = 'True'
21+ information_type = InformationType.USERDATA.value
22 if x == 4:
23 stacked_on = self.branch_ids[3]
24 elif x == 6:
25@@ -38,11 +43,12 @@
26 stacked_on = 'NULL'
27 cur.execute("""
28 INSERT INTO Branch (
29- name, private, stacked_on, owner, registrant, branch_type
30+ name, private, information_type, stacked_on, owner,
31+ registrant, branch_type
32 )
33- VALUES ('branch%d', %s, %s, 1, 1, 1)
34+ VALUES ('branch%d', %s, %s, %s, 1, 1, 1)
35 RETURNING id
36- """ % (x, is_private, stacked_on))
37+ """ % (x, is_private, information_type, stacked_on))
38 branch_id = cur.fetchone()[0]
39 self.branch_ids[x] = branch_id
40 self.updateStackedOnForBranch(2, 5)