~launchpad-pqm/launchpad/devel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
Project Group Set views
========================

Project groups cannot be administered by end-users.  Only members of the
admins and registry admins teams can list, create, or review them.

    >>> from lp.registry.interfaces.projectgroup import IProjectGroupSet
    >>> from lp.app.interfaces.launchpad import ILaunchpadCelebrities
    >>> from canonical.launchpad.webapp.authorization import check_permission
    >>> login('no-priv@canonical.com')
    >>> project_set = getUtility(IProjectGroupSet)


Accessing the +index view
-------------------------

A Launchpad admin has permission to access the +index view.

    >>> view = create_view(project_set, name='+index')

    >>> login('foo.bar@canonical.com')
    >>> check_permission('launchpad.Moderate', view)
    True

The view provides a page_title.

    >>> print view.page_title
    Project groups registered in Launchpad

A regular user cannot access the view.

    >>> user = factory.makePerson()
    >>> login_person(user)
    >>> celebs = getUtility(ILaunchpadCelebrities)
    >>> registry = celebs.registry_experts
    >>> user.inTeam(registry)
    False

    >>> check_permission('launchpad.Moderate', view)
    False

A member of the registry team has permission.

    >>> registry_member = factory.makePerson()
    >>> login('foo.bar@canonical.com')
    >>> ignored = registry.addMember(registry_member, registry.teamowner)
    >>> registry_member.inTeam(registry)
    True

    >>> login_person(registry_member)
    >>> check_permission('launchpad.Moderate', view)
    True


Accessing the +all view
-----------------------

A Launchpad admin has permission to access the +all view.

    >>> view = create_view(project_set, name='+all')
    >>> login('foo.bar@canonical.com')
    >>> check_permission('launchpad.Moderate', view)
    True

The view provides a page_title.

    >>> print view.page_title
    Project groups registered in Launchpad

A regular user cannot access the view.

    >>> login_person(user)
    >>> check_permission('launchpad.Moderate', view)
    False

A member of the registry team has permission.

    >>> login_person(registry_member)
    >>> check_permission('launchpad.Moderate', view)
    True


Accessing the +new view
-----------------------

A Launchpad admin has permission to access the +new view.

    >>> view = create_view(project_set, name='+new')
    >>> login('foo.bar@canonical.com')
    >>> check_permission('launchpad.Moderate', view)
    True

    >>> print view.page_title
    Register a project group with Launchpad

A regular user cannot access the view.

    >>> login_person(user)
    >>> check_permission('launchpad.Moderate', view)
    False

A member of the registry team has permission.

    >>> login_person(registry_member)
    >>> check_permission('launchpad.Moderate', view)
    True