Merge lp:~sinzui/launchpad/export-private-bugs-0 into lp:launchpad

Proposed by Curtis Hovey on 2012-01-23
Status: Merged
Merged at revision: 14715
Proposed branch: lp:~sinzui/launchpad/export-private-bugs-0
Merge into: lp:launchpad
Diff against target: 44 lines (+4/-3)
2 files modified
lib/lp/registry/interfaces/product.py (+2/-2)
lib/lp/registry/stories/webservice/xx-project-registry.txt (+2/-1)
To merge this branch: bzr merge lp:~sinzui/launchpad/export-private-bugs-0
Reviewer Review Type Date Requested Status
Benji York (community) code 2012-01-23 Approve on 2012-01-23
Review via email: mp+89784@code.launchpad.net

Description of the Change

Export private_bugs to the API.

    Launchpad bug: https://bugs.launchpad.net/bugs/920566
    Pre-implementation: no one

It is not possible to setup a project using a script so that it has private
bugs by default.

--------------------------------------------------------------------

RULES

    * Export the private_bugs attr.

QA

    As a Registry Administrator or Commercial Admin
    * Using an API script, verify you can set the private_bugs flag.

    from launchpadlib.launchpad import Launchpad
    lp = Launchpad.login_with(
        'testing', service_root='https://api.qastaging.launchpad.net',
        version='devel')
    project = lp.projects['pocket-lint']
    print "private_bugs is %s" % project.private_bugs
    project.private_bugs = not project.private_bugs
    project.lp_save()
    print "set private_bugs to %s" % project.private_bugs

LINT

    lib/lp/registry/interfaces/product.py
    lib/lp/registry/stories/webservice/xx-project-registry.txt

TEST

    ./bin/test -vv -t xx-project-registry lp.registry.tests.test_doc

IMPLEMENTATION

Updated the doctest to verify private_bugs was exported and then exported
the attr.
    lib/lp/registry/interfaces/product.py
    lib/lp/registry/stories/webservice/xx-project-registry.txt

To post a comment you must log in.
Benji York (benji) wrote :

The paranoid part of me wonders if we should have a test to show that
mutating the private_bugs attribute actually works, but the pragmatic
and lazy parts say that we should just assume that the lazr.restful
machinery does what it is supposed to do and it's tested and QA
will show if it works or not, so it isn't much of a concern.

In conclusion: this branch looks good to us.

review: Approve (code)
Curtis Hovey (sinzui) wrote :

I thought the same. I trust that zope.schema and lazr.restful are well tested and that Lp has proper integrations tests. So I then wonders if there was something arcane about the field that needs testing over the API, but I could not find any issues reviewing Lp's code or my same script.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/registry/interfaces/product.py'
2--- lib/lp/registry/interfaces/product.py 2012-01-01 02:58:52 +0000
3+++ lib/lp/registry/interfaces/product.py 2012-01-23 20:50:04 +0000
4@@ -613,10 +613,10 @@
5 description=_("Whether or not this project's attributes are "
6 "updated automatically."))
7
8- private_bugs = Bool(title=_('Private bugs'),
9+ private_bugs = exported(Bool(title=_('Private bugs'),
10 description=_(
11 "Whether or not bugs reported into this project "
12- "are private by default."))
13+ "are private by default.")))
14 licenses = exported(
15 Set(title=_('Licenses'),
16 value_type=Choice(vocabulary=License)))
17
18=== modified file 'lib/lp/registry/stories/webservice/xx-project-registry.txt'
19--- lib/lp/registry/stories/webservice/xx-project-registry.txt 2011-12-24 15:18:32 +0000
20+++ lib/lp/registry/stories/webservice/xx-project-registry.txt 2012-01-23 20:50:04 +0000
21@@ -176,6 +176,7 @@
22 name: u'firefox'
23 official_bug_tags: []
24 owner_link: u'http://.../~name12'
25+ private_bugs: False
26 programming_language: None
27 project_group_link: u'http://.../mozilla'
28 project_reviewed: False
29@@ -241,6 +242,7 @@
30 name: u'firefox'
31 official_bug_tags: []
32 owner_link: u'http://.../~name12'
33+ private_bugs: False
34 programming_language: None
35 project_group_link: u'http://.../mozilla'
36 project_reviewed:...redacted...
37@@ -402,7 +404,6 @@
38 When the owner_link is changed the ownership of some attributes is
39 changed as well.
40
41- >>> # Create a product with a series and release.
42 >>> login('test@canonical.com')
43 >>> test_project_owner = factory.makePerson(name='test-project-owner')
44 >>> test_project = factory.makeProduct(